摘要: 1 #include<stdio.h> 2 #include<math.h> 3 4 int sumdigit(int n) 5 { 6 int sum = 0; 7 while(n != 0) 8 { 9 sum += n%10;10 n /= 10;11 }12 return sum;13 }14 15 int Prime(int n) //判断素数因子的位数之和,这是关键。16 {17 int i, tn=n, sum =0;18 19 for( i = 2; i*i <= n; i... 阅读全文
posted @ 2011-08-18 22:06 zhongya 阅读(219) 评论(0) 推荐(1) 编辑
摘要: 1 #include<stdio.h> 2 3 int gcd(int a,int b) 4 { 5 if(b == 0) 6 return a; 7 else 8 return gcd(b,a%b); 9 }10 11 int main()12 {13 int step, mod;14 15 while(scanf("%d%d", &step,&mod) != EOF)16 {17 printf("%10d%10d",step,mod);18 if(gcd(step,mod) == 1... 阅读全文
posted @ 2011-08-18 17:49 zhongya 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 3 int main() 4 { 5 int k, n; 6 long long num; 7 8 while(scanf("%d", &n) != EOF) 9 {10 k = 1; 11 num = 1;12 while(num%n != 0)13 {14 num = (num*10+1)%n; //一开始把n忘了写超时了,最后改了一下 15 k++;16 }17 prin... 阅读全文
posted @ 2011-08-18 17:47 zhongya 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 3 int main() 4 { 5 int ncases, k; 6 long n; 7 8 while(scanf("%d", &ncases) != EOF) 9 {10 while (ncases--)11 {12 scanf("%ld", &n);13 k = 1;14 while(n != 1)15 {16 k++;17 ... 阅读全文
posted @ 2011-08-18 14:01 zhongya 阅读(168) 评论(0) 推荐(0) 编辑