摘要:
2011-12-15 04:54:11地址:http://acm.hdu.edu.cn/showproblem.php?pid=1406题意:中文,找完数。mark:打表,范围内只有4个完数:6、28、496、8128。代码:# include <stdio.h>int main (){ int i, t, a, b, sum ; int tab[4] = {6, 28, 496, 8128} ; scanf ("%d", &t) ; while (t--) { scanf ("%d%d", &a, &b) ; if 阅读全文
posted @ 2012-01-06 15:40
Seraph2012
阅读(195)
评论(0)
推荐(0)
摘要:
2011-12-15 04:45:53地址:http://acm.hdu.edu.cn/showproblem.php?pid=1877题意:中文。又见进制转换。代码:# include <stdio.h>void output(int n, int m){ if (n == 0) return ; output (n/m, m) ; printf ("%d", n%m) ;}int main (){ int m, a, b ; while (~scanf ("%d", &m) && m) { scanf (" 阅读全文
posted @ 2012-01-06 15:39
Seraph2012
阅读(122)
评论(0)
推荐(0)
摘要:
2011-12-15 04:41:23地址:http://acm.hdu.edu.cn/showproblem.php?pid=1870题意:中文。。。代码:# include <stdio.h>char str[1010] ;int main (){ int p, i ; while(gets(str)) { p = 0 ; for (i = 0 ; str[i] && str[i] != 'B' ; i++) { if (str[i] == '(') p++ ; else if (str... 阅读全文
posted @ 2012-01-06 15:36
Seraph2012
阅读(174)
评论(0)
推荐(0)
摘要:
2011-12-15 04:32:49地址:http://acm.hdu.edu.cn/showproblem.php?pid=2083题意:中文。mark:中位数。代码:# include <stdio.h># include <stdlib.h>int a[510] ;int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b ;}int abs(int n){return n<0?-n:n;}int main (){ int T, n, i, sum ; scanf ("%d& 阅读全文
posted @ 2012-01-06 15:35
Seraph2012
阅读(127)
评论(0)
推荐(0)
摘要:
2011-12-15 04:37:17地址:http://acm.hdu.edu.cn/showproblem.php?pid=2085题意:中文。裸递推。代码:# include <stdio.h>long long dp[40][2] = {1, 0} ;int main (){ int i, n ; for (i = 1 ; i<= 33 ; i++) { dp[i][0] = dp[i-1][0]*3 + dp[i-1][1]*2 ; dp[i][1] = dp[i-1][0] + dp[i-1][1] ; } whil... 阅读全文
posted @ 2012-01-06 15:35
Seraph2012
阅读(169)
评论(0)
推荐(0)
摘要:
2011-12-15 04:27:58地址:http://acm.hdu.edu.cn/showproblem.php?pid=2190题意:中文。。mark:递推,可以用两种状态搞,也可以直接搞。dp[i] = dp[i-2]*3+dp[i-3]*2。代码:# include <stdio.h>int dp[35] = {1, 1, 3} ;int main (){ int i, n ; for (i = 2 ; i <= 30 ; i++) dp[i] = dp[i-2]*3 + dp[i-3]*2 ; scanf ("%d", &n) ; w 阅读全文
posted @ 2012-01-06 15:34
Seraph2012
阅读(162)
评论(0)
推荐(0)
摘要:
2011-12-15 04:19:03地址:http://acm.hdu.edu.cn/showproblem.php?pid=2067题意:中文。。。mark:真心麻烦,二维递推。没用long long导致wa了一次。代码:# include <stdio.h>long long dp[40][40] ;int main (){ int nCase = 1, n ; dp[0][0] = 1 ; int i, j ; for (i = 1 ; i <= 35 ; i++) { dp[i][0] = 1 ; for (j = 1 ; j... 阅读全文
posted @ 2012-01-06 15:33
Seraph2012
阅读(157)
评论(0)
推荐(0)
摘要:
2011-12-15 04:01:32地址:http://acm.hdu.edu.cn/showproblem.php?pid=2501题意:中文。。mark:递推又见递推。dp[i] = dp[i-1] + dp[i-2]*2。代码:# include <stdio.h>int dp[35] = {1, 1} ;int main (){ int i, T ; for (i = 2 ; i<= 30 ; i++) dp[i] = dp[i-1] + dp[i-2]*2 ; scanf ("%d", &T) ; while(~scanf (" 阅读全文
posted @ 2012-01-06 15:19
Seraph2012
阅读(143)
评论(0)
推荐(0)
摘要:
2011-12-15 03:57:35地址:http://acm.hdu.edu.cn/showproblem.php?pid=2504题意:中文。。。mark:注意有不是2*b的情况——那就是a/b是偶数。代码:# include <stdio.h>int gcd(int a, int b){return a%b?gcd(b,a%b):b ;}int main (){ int n ; int a, b, c ; scanf ("%d", &n) ; while (n--) { scanf ("%d%d", &a, & 阅读全文
posted @ 2012-01-06 15:18
Seraph2012
阅读(166)
评论(0)
推荐(0)
摘要:
2011-12-15 03:51:16地址:http://acm.hdu.edu.cn/showproblem.php?pid=1008题意:给一串数字,模拟电梯运行。电梯上一层楼耗费6s,下一层耗费4s,停耗费5s,初始在0,问总时间。mark:模拟。。。代码:# include <stdio.h>int main (){ int n ; int sum, cur, num ; while (~scanf ("%d", &n) && n) { sum = cur = 0 ; while (n--) { ... 阅读全文
posted @ 2012-01-06 15:16
Seraph2012
阅读(169)
评论(0)
推荐(0)

浙公网安备 33010602011771号