- 博客(19)
- 收藏
- 关注
原创 PAT乙级1040 有几个PAT (25分)
链接AC://1040 有几个PAT (25分)#include <stdio.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <math.h>#define LIM 1000000007int main(){ char c; int p = 0, pa = 0, pat = 0; while ((c = getc
2020-12-02 21:31:46
126
原创 PAT乙级 1033 旧键盘打字 (20分)
链接最后一个测试点超时:采用while (scanf("%c", &c) != EOF)的方法确保了不会超时AC程序://1033 旧键盘打字 (20分)#include <stdio.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <math.h>int main(){ char bad[100001]; get
2020-12-01 17:18:49
96
原创 PAT乙级1003 我要通过! (20分)
链接解析:链接感谢上面大佬的解析答案://1003 我要通过! (20分)#include <stdio.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <math.h>int main(){ int n; scanf("%d", &n); getchar(); int cnt = 0;
2020-11-30 15:13:29
82
原创 买苹果
题目链接代码:#include <stdio.h>#include <string.h>#include <ctype.h>#include <stdlib.h>#include <math.h>int main(){ int n; scanf("%d",&n); if (n%2!=0||n==10||n<6) { printf("-1"); } e
2020-11-06 20:17:32
75
原创 求最大公约数 (辗转相除法) 和 最小公倍数
辗转相除法基本原理:首先a >= ba / b == q … r1 (r1 >= 0)如果 r1 == 0, 则最大公约数为b如果 r1 != 0, 则 b / r1 == q … r2 (r2 >= 0)直到最后一个余数为零的式子的除数就是其最大公约数递归代码:int gcd(int a, int b){ if (b == 0) return a; return gcd(b, a%b);}...
2020-11-06 18:44:51
136
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人