
数据结构 - STL
文章平均质量分 80
i逆天耗子丶
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PAT - 甲级 - 1112. Stucked Keyboard (20) (STL - vector)
题目描述: On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on screen for k times. Now given原创 2017-03-29 22:51:39 · 831 阅读 · 0 评论 -
PAT - 甲级 - 1014. Waiting in Line (30)(STL-queue)
Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The原创 2017-12-01 17:29:36 · 326 阅读 · 0 评论 -
PAT - 甲级 - 1129. Recommendation System (25)(STL - set)
题目描述: Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates the user's preference by the num原创 2017-04-04 23:54:13 · 1806 阅读 · 1 评论 -
PAT - 甲级 - 1022. Digital Library (30)(STL-map,set)
A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a原创 2017-11-16 15:23:26 · 320 阅读 · 0 评论 -
PAT - 甲级 - 1039. Course List for Student (25)(STL-vecotr)
Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who comes原创 2017-11-16 15:14:41 · 299 阅读 · 0 评论 -
PAT - 甲级 - 1071. Speech Patterns (25)(STL-map)
People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzing such patterns can help to narrow down a speaker原创 2017-11-18 16:32:30 · 439 阅读 · 0 评论 -
PAT - 甲级 - 1063. Set Similarity (25)(STL-set)
Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total number of distinct n原创 2017-11-18 12:22:49 · 338 阅读 · 0 评论 -
PAT - 甲级 - 1054. The Dominant Color (20)(STL-map)
Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the d原创 2017-11-17 17:48:17 · 303 阅读 · 0 评论 -
PAT - 甲级 - 1047. Student List for Course (25)(STL-vector)
Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses. Input S原创 2017-11-17 14:01:06 · 259 阅读 · 0 评论 -
NYOJ - 55 - 懒省事的小明(优先队列-priority_queue)
题目描述: 描述 小明很想吃果子,正好果园果子熟了。在果园里,小明已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。小明决定把所有的果子合成一堆。 因为小明比较懒,为了省力气,小明开始想点子了: 每一次合并,小明可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了。小明在合并果子时总共消耗的体力等原创 2017-04-13 08:23:37 · 651 阅读 · 0 评论 -
NYOJ - 93 - 汉诺塔(三)(STL - stack)
题目描述: 输入 第一行输入一个整数N表示测试数据的组数(N 每组测试数据的第一行有两个整数P,Q(1 输出 如果存在非法指令,请输出illegal 不存在非法指令则输出legal 样例输入 3 2 1 1 2 3 3 1 2 1 3 3 2 2 1 2 1 样例输出 legal illegal illegal原创 2017-04-13 17:39:46 · 448 阅读 · 0 评论 -
NYOJ - 95 - 众数问题(STL - map)
题目描述: 描述 输入第一行为n,表示测试数据组数。(n 每组测试的第一行是一个整数m,表示多重集S中元素的个数为m 接下来的一行中给出m(m (不会出现不同元素出现的次数相同的情况,如:S={11,11,22,22,33,33})。 输出每组测试数据输出一行,包含两个数,第一个是众数,第二个是其重数,中间以空格隔开。 样例输入 1 6 1 2 2 2 3 5 样原创 2017-04-13 17:28:48 · 681 阅读 · 0 评论 -
NYOJ - 19 - 擅长排列的小明(STL - set +全排列)
题目描述: 描述 小明十分聪明,而且十分擅长排列计算。比如给小明一个数字5,他能立刻给出1-5按字典序的全排列,如果你想为难他,在这5个数字中选出几个数字让他继续全排列,那么你就错了,他同样的很擅长。现在需要你写一个程序来验证擅长排列的小明到底对不对。 输入 第一行输入整数N(1 每组测试数据第一行两个整数 n m (1 输出 在1-n中选取m个字符进行全排列,按字典序全部输出,原创 2017-04-12 22:43:53 · 545 阅读 · 0 评论 -
NYOJ - 8 - 一种排序(STL - set)
题目描述: 描述 现在有很多长方形,每一个长方形都有一个编号,这个编号可以重复;还知道这个长方形的宽和长,编号、长、宽都是整数;现在要求按照一下方式排序(默认排序规则都是从小到大); 1.按照编号从小到大排序 2.对于编号相等的长方形,按照长方形的长排序; 3.如果编号和长都相同,按照长方形的宽排序; 4.如果编号、长、宽都相同,就只保留一个长方形用于排序,删除多余的长方形原创 2017-04-12 22:16:03 · 451 阅读 · 0 评论 -
NYOJ - 2 - 括号配对问题(STL - stack)
题目描述: 描述 现在,有一行括号序列,请你检查这行括号是否配对。 输入 第一行输入一个数N(0 输出 每组输入数据的输出占一行,如果该字符串中所含的括号是配对的,则输出Yes,如果不配对则输出No 样例输入 3 [(]) (]) ([[]()]) 样例输出 No No Yes 题目思路: 遍历字符串的每一个字符,如果是'['或者是'('则入栈原创 2017-04-12 22:09:30 · 497 阅读 · 0 评论 -
PAT - 甲级 - 1056. Mice and Rice (25)(STL-queue)
Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice原创 2017-12-01 17:45:32 · 331 阅读 · 0 评论