PAT甲级
文章平均质量分 83
hidentity
这个作者很懒,什么都没留下…
展开
-
PAT A1072. Gas Station
一道简单的图算法题,我的做法是对每个Candidate节点做一次迪杰斯特拉算法,然后选择最优的节点。唯一需要注意的一点是这道题的节点选择条件比较绕原创 2017-04-07 15:35:07 · 620 阅读 · 1 评论 -
PAT A1016.Phone Bills
A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. Wh原创 2017-05-27 21:34:39 · 219 阅读 · 0 评论 -
PAT A1101.Quick Sort
There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to its le原创 2017-05-27 21:28:21 · 242 阅读 · 0 评论 -
PAT A1078.Hashing
1078. Hashing (25)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe task of this problem is simple: insert a seque原创 2017-05-27 17:58:00 · 222 阅读 · 0 评论 -
PAT A1010. Radix PAT和牛客网全A思路以及PAT上测试例10的讨论
就是这个想法,导致了测试例10的错误。我之前特费解,测试例10的内容到底是啥,好像有很多人错,甚至还有人说测试例10有问题,PAT平台上的答案有错误。看到有人贴出的全A的代码中,只要添上一段if(str1==str2) cout<<Radix;这样的代码,就能通过测试例10,我更加不解了。很显然这段代码是错误的。举个例子,如果一个测试例的内容是“1 1 1 10”,显然正确答案是2。但是如果添上上述的那段代码,这个测试例的输出会变成10,是错误的。原创 2017-04-09 21:38:51 · 696 阅读 · 0 评论 -
PAT A1007. Maximum Subsequence Sum
这道题的动态规划思想非常简单:(1)记录以第i位为结尾的所有连续子串中,sum最大的那一个连续子串的sum和起始点。举两个例子————串{1 2 3 4 5 6}中,以3为尾时,最大连续子串和为6(1+2+3),起始点为1;在串{-1 -2 3 4 5 6}中,以3为尾时,最大连续子串和为3,起始点就是3。原创 2017-04-07 18:42:54 · 206 阅读 · 0 评论 -
PAT A1018. Public Bike Management
PAT A1018. Public Bike Management原创 2017-04-06 13:48:33 · 326 阅读 · 0 评论 -
PAT A1005. Spell It Right
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case.原创 2017-04-06 19:06:54 · 350 阅读 · 0 评论 -
PAT A1002. A+B for Polynomials
用map就可以很轻松地写出来,但是提交之后只对了前三个测试例,费解很久。为了不浪费时间,最后还是去牛客网上试了测试例,发现是因为系数为0的项应该被及时去除。知道这个原因后稍作修改就AC了。原创 2017-04-07 17:42:26 · 213 阅读 · 0 评论 -
PAT A1082. Reading Number in Chinese
PAT A1082. Reading Number in Chinese原创 2017-04-05 21:04:00 · 661 阅读 · 0 评论 -
PAT A1001. A+B Format
Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEach input file cont原创 2017-04-06 19:31:21 · 251 阅读 · 0 评论 -
PAT A1096.Consecutive Factors
Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, and 7 are the three consecutive numbers. Now given原创 2017-09-09 21:08:01 · 248 阅读 · 0 评论