上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 51 下一页
摘要: 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 阅读(163) 评论(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 阅读(120) 评论(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 阅读(159) 评论(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 阅读(152) 评论(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 阅读(151) 评论(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 阅读(132) 评论(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 阅读(155) 评论(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 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 2011-12-15 03:44:22地址:http://acm.hdu.edu.cn/showproblem.php?pid=2502题意:中文。。。mark:应该有公式,不过直接递推吧。。。dp[i]表示所有长度小于等于i的数共有多少个1。代码:# include <stdio.h># include <stdlib.h>int dp[25] = {0, 1} ;int main (){ int i ; for (i = 2 ; i <= 20 ; i++) dp[i] = dp[i-1] * 2 + (1 << (i-1)) ; scanf (& 阅读全文
posted @ 2012-01-06 15:14 Seraph2012 阅读(198) 评论(1) 推荐(0) 编辑
摘要: 2011-12-15 03:38:08地址:http://acm.hdu.edu.cn/showproblem.php?pid=2535题意:中文~mark:坑爹。wa了。是超过一半,不是超过或等于一半。代码:# include <stdio.h># include <stdlib.h>int cmp(const void *a, const void *b){ return *(int*)a - *(int*) b ;}int main (){ int n, i, sum ; int a[110] ; while (~scanf ("%d", &a 阅读全文
posted @ 2012-01-06 15:13 Seraph2012 阅读(199) 评论(0) 推荐(0) 编辑
上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 51 下一页