![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PATA
he626shidizai
这个作者很懒,什么都没留下…
展开
-
pat甲级常用函数和简单经验分享
1. 求最大公因数int gcd(int a, int b){ return b == 0 ? a : gcd(b, a%b);}2. 判断素数bool isprime(int n){ if(n == 1) return false; int sqr = (int)sqrt(n); for(int i = 2; i <= sqr; i++){ ...原创 2019-12-25 09:29:59 · 327 阅读 · 0 评论 -
PAT A1007 最大子列和
写这道题的时候才意识到审题是多么的重要,最前面的分析错了,后面怎么都不会对的。改了好多次才成功,而且还只能打补丁。输出有很多需要注意的点:output the one with the smallest indices i and j (as shown by the sample case)----也就是说 如果子列是 0 0 1 2 3 的情况,那么子列的第一个元素是0而不是1If a...原创 2019-03-11 13:40:41 · 367 阅读 · 0 评论