上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 51 下一页
摘要: 2011-12-16 01:50:33地址:http://acm.hdu.edu.cn/showproblem.php?pid=1570题意:算排列&组合数。数据忒小,不用考虑溢出。代码:# include <stdio.h>int factorial[15] = {1, 1} ;int main (){ int i, T, a, b ; char ch ; for(i = 2 ; i <= 10 ; i++) factorial[i] = factorial[i-1] * i ; scanf ("%d%*c", &T) ; while ( 阅读全文
posted @ 2012-01-06 16:35 Seraph2012 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 01:37:28地址:http://acm.hdu.edu.cn/showproblem.php?pid=1555题意:中文。。。mark:2WA,老老实实模拟,想用除法和取mod算,必死。不可借钱,但是结果可以迭代。代码:# include <stdio.h>int main (){ int m, k, ans ; while (~scanf ("%d%d", &m, &k) && (m||k)) { ans = 0 ; while (m) { ans ++ ; m-... 阅读全文
posted @ 2012-01-06 16:34 Seraph2012 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 01:03:32地址:http://acm.hdu.edu.cn/showproblem.php?pid=1262题意:中文,验证哥德巴赫猜想。mark:wa一次,例如6 = 3+3这种,3,3居然也算素数对。。。。代码:# include <stdio.h>int n, a, b ;int IsPrime(int p){ int i ; for (i = 2 ; i < p ; i++) if (p%i==0) return 0 ; return 1 ;}void gao(int n){ int p, q ; p = n/2,... 阅读全文
posted @ 2012-01-06 16:33 Seraph2012 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 00:57:22地址:http://acm.hdu.edu.cn/showproblem.php?pid=1210题意:中文。。。mark:枚举了”1“的变化位置,然后计数。当1回到第一位,则停止。代码:# include <stdio.h>int calc(int n){ int cnt = 0, cur = 1 ; do{ if (cur <= n) cur = 2*cur ; else cur = (cur-n) * 2 - 1 ; cnt++ ; }while (cur != 1) ; return... 阅读全文
posted @ 2012-01-06 16:32 Seraph2012 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 00:13:46地址:http://acm.hdu.edu.cn/showproblem.php?pid=1235题意:中文。。。代码:# include <stdio.h>int a[1010], num, n ;int main (){ int ans, i ; while (~scanf ("%d", &n) && n) { for (i = 0 ; i < n ; i++) scanf ("%d", &a[i]) ; scanf ("%d", &n 阅读全文
posted @ 2012-01-06 16:19 Seraph2012 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 2011-12-16 00:08:13地址:http://acm.hdu.edu.cn/showproblem.php?pid=1229题意:中文。。。代码:# include <stdio.h>int test(int a, int b, int k){ while (k--) { if (a%10 != b%10) return 0 ; a /= 10 ; b /= 10 ; } return 1 ;}int main (){ int a, b, k ; while (~scanf ("%d%d%d", &a, ... 阅读全文
posted @ 2012-01-06 16:18 Seraph2012 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 2011-12-15 23:49:02地址:http://acm.hdu.edu.cn/showproblem.php?pid=1097题意:求a的b次方的最后一个数字。mark:数论公式,b = b%4+4。直接暴力。不需要快速幂。代码:# include <stdio.h>int qpow(int a, int b){ int i, mul = 1 ; for (i = 0 ; i < b ; i++) mul = mul * a % 10 ; return mul ;}int main (){ int a, b ; while (~scanf ... 阅读全文
posted @ 2012-01-06 16:17 Seraph2012 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 2011-12-15 23:53:54地址:http://acm.hdu.edu.cn/showproblem.php?pid=1170题意:四则运算。。。代码:# include <stdio.h>int main (){ int T, a, b ; char op ; scanf ("%d%*c", &T) ; while(T--) { scanf ("%c %d %d%*c", &op, &a, &b) ; if (op == '+') printf ("%d\n", 阅读全文
posted @ 2012-01-06 16:17 Seraph2012 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 2011-12-15 23:42:25地址:http://acm.hdu.edu.cn/showproblem.php?pid=1040题意:给n个数,排序后输出。代码:# include <stdio.h># include <stdlib.h>int a[1010] ;int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b ;}int main (){ int i, T, n ; scanf ("%d", &T) ; while (T--) { scanf (&q 阅读全文
posted @ 2012-01-06 16:08 Seraph2012 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 2011-12-15 22:56:08地址:http://acm.hdu.edu.cn/showproblem.php?pid=1076题意:求y之后第n个闰年是哪年(如果y是闰年,y算第一年)。代码:# include <stdio.h>int IsLeap(int y){ if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) return 1 ; return 0 ;}int nextleapyear(int y){ int rtn = y+1 ; while (!IsLeap(rtn)) rtn++ ; ... 阅读全文
posted @ 2012-01-06 16:07 Seraph2012 阅读(137) 评论(0) 推荐(0) 编辑
上一页 1 ··· 36 37 38 39 40 41 42 43 44 ··· 51 下一页