PAT
文章平均质量分 60
小米枸杞粥
这个作者很懒,什么都没留下…
展开
-
Maximum Subsequence Sum-总结
Sample Input: 10 -10 1 2 3 4 -5 -23 3 7 -21 Sample Output: 10 1 4 思路: 使用动态规划,将扫描的数字进行相加,若小于,则舍去,若大于等于0,则继续相加。记录最大值。 将maxcount设为-1,因为数字皆为整数,负数最大值为-1,即若全为负数,maxcount的最终值为-1。 //注意!在这里要先与maxcount进行比较,再将count设置为0,否则全为负数的情况下maxcount会变为0; //count>maxcoun..原创 2021-10-23 13:44:56 · 182 阅读 · 0 评论 -
【PAT】1002 A+B for Polynomials (25 分)
含避坑指南 This time, you are supposed to find A+B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial: K N1 aN1 N2 aN2原创 2021-09-17 19:01:31 · 65 阅读 · 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). Input Specification: Each input file contains one test case. Each case contains a pair of i原创 2021-09-16 22:54:05 · 88 阅读 · 0 评论