1.5k1 分钟

辗转相除法找最大公约数,然后用欧拉筛求出以内的质数与是否除尽来找答案 另好像有其他好方法,数论渣渣😪 #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define LL long long #define IN freopen("in.txt", "r", stdin) #define OUT freopen("out.txt", "w", stdou
7311 分钟

#include <stdio.h> #include<string.h> #include<stdlib.h> #define LL long long #define IN freopen("in.txt", "r", stdin) #define OUT freopen("out.txt", "w", stdout) #define scan(x) scanf("%lld", &x) #define sqr(x) (x) * (x) #defi
4021 分钟

做这个是真的不快乐,开个sta数组来验证是否重复即是否进入循坏 那个图灵班看来是指望不上了,太懒了。😴 int sum (int n) { int a=0; while(n>0){ a+=(n%10) *(n%10); n /=10; } return a; } bool isHappy(int n){ int sta[10001]; memset(sta,0,10001); long long int a=0; if (n ==
3521 分钟

数据范围,emmm,果断字符串做 #include <stdio.h> #include <string.h> #define scan(x) scanf("%d", &x) int main() { char s[10000]; int a, x; scan(a); while (a--) { scanf("%s", s); x = s[strlen(s) - 1] - '0'; if