随笔分类 -  PAT(A level)

浙大PAT 甲级题目解答,持续更新。
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueShuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to av... 阅读全文
posted @ 2015-12-06 10:51 白夜行zz 阅读(152) 评论(0) 推荐(0)
摘要:注意n的值很大的时候不能使用两层嵌套算法,这样执行时间将会很长时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueBeing unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of... 阅读全文
posted @ 2015-12-06 10:49 白夜行zz 阅读(218) 评论(0) 推荐(0)
摘要:Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given "Is PAT&TAP symmetric?", the longest symmetric sub-string is "s PAT&TAP s", hence you must... 阅读全文
posted @ 2015-12-06 10:46 白夜行zz 阅读(188) 评论(0) 推荐(0)
摘要:1039. Course List for Student (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueZhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all th... 阅读全文
posted @ 2015-12-06 10:44 白夜行zz 阅读(179) 评论(0) 推荐(0)
摘要:1,注意加法越界的问题,用long long可以存一次和,相加之后要写加法器来做2,注意vector 中是用 size() 函数来表示其内部的个数的。 结尾附上常用vector函数The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning th... 阅读全文
posted @ 2015-12-06 10:43 白夜行zz 阅读(151) 评论(0) 推荐(0)
摘要:Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given {32, 321, 3214, 0229, 87}, we can recover many numbers such like 32-321-3214-0229-8... 阅读全文
posted @ 2015-12-06 10:43 白夜行zz 阅读(192) 评论(0) 推荐(0)
摘要:This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:Each input file contains one test ... 阅读全文
posted @ 2015-12-06 10:42 白夜行zz 阅读(210) 评论(0) 推荐(0)
摘要:To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distinguish 1 (one) from l (L ... 阅读全文
posted @ 2015-12-06 10:41 白夜行zz 阅读(154) 评论(0) 推荐(0)
摘要:贪心算法的模拟题。时间限制10 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者ZHANG, GuochuanWith highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited,... 阅读全文
posted @ 2015-12-06 10:40 白夜行zz 阅读(174) 评论(0) 推荐(0)
摘要:注意这里n是电话数,电话数不超过1000代表人数不超过两千,。。。好坑。。。。时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueOne way that the police finds the head of a gang is to check people's phone calls. If there is a phone ... 阅读全文
posted @ 2015-12-06 10:40 白夜行zz 阅读(141) 评论(0) 推荐(0)
摘要:时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueTo store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share th... 阅读全文
posted @ 2015-12-06 10:37 白夜行zz 阅读(140) 评论(0) 推荐(0)
摘要:时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as:... 阅读全文
posted @ 2015-12-06 10:36 白夜行zz 阅读(152) 评论(0) 推荐(0)
摘要:1,注意algorithm 里面有merge函数2,scanf 比cin快许多,大约是后者1/33,输入long int 用scanf("%ld", &a[i]); 是小写的l时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven an increasing sequence S of N integers, the med... 阅读全文
posted @ 2015-12-06 10:35 白夜行zz 阅读(167) 评论(0) 推荐(1)
摘要:dfs使用vector保存最短路径时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are s... 阅读全文
posted @ 2015-12-06 10:35 白夜行zz 阅读(233) 评论(0) 推荐(0)
摘要:printf 比cout 执行要快时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueExcel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains o... 阅读全文
posted @ 2015-12-06 10:34 白夜行zz 阅读(133) 评论(0) 推荐(0)
摘要:People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 dig... 阅读全文
posted @ 2015-12-06 10:33 白夜行zz 阅读(133) 评论(0) 推荐(0)
摘要:注意数据合法性的检测。26分的时候 有人打了两个多小时,只能打两个小时,有人9点之后来的,要排除。时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA table tennis club has N tables available to the public. The tables are numbered from 1 to ... 阅读全文
posted @ 2015-12-06 10:30 白夜行zz 阅读(401) 评论(0) 推荐(0)
摘要:尽量避免二次循环,很容易运行超时。该算法用printf 用时30ms 使用cout 运行75ms,只差这一句话。所以输出很多的时候不应该使用coutg++ 编译器使用 strcmp 一定要引用 string.h 头Programming Ability Test (PAT) is organized by the College of Computer Science and Technology... 阅读全文
posted @ 2015-12-06 10:29 白夜行zz 阅读(193) 评论(0) 推荐(0)
摘要:A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers... 阅读全文
posted @ 2015-12-06 10:28 白夜行zz 阅读(325) 评论(0) 推荐(0)
摘要:Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number con... 阅读全文
posted @ 2015-12-06 10:25 白夜行zz 阅读(162) 评论(0) 推荐(0)