上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 51 下一页
摘要: 2012-01-02 04:07:41地址:http://acm.hdu.edu.cn/showproblem.php?pid=2516题意:中文。mark:完全不会。看了网上说打表看出规律似乎是Fibonacci。遂写代码。wa了一次,因为[0...43]的数量我用二分的时候居然算成了43个。。。应该是44个的。代码:# include <stdio.h># include <stdlib.h>int dp[50] = {2, 3} ;int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b ; 阅读全文
posted @ 2012-01-07 00:35 Seraph2012 阅读(140) 评论(0) 推荐(0)
摘要: 2011-12-31 20:47:45地址:http://acm.hdu.edu.cn/showproblem.php?pid=2512题意:中文。。。mark:递推。dp[i][j]表示i张卡片分在j本书的种类数,有dp[i][j] = dp[i-1][j-1] + dp[i-1][j]*j。代码:# include <stdio.h># define MOD 1000int dp[2010][2010] ;int ans[2010] = {0, 1} ;int main (){ int T, n ; int i, j ; dp[1][1] = 1 ; for (i ... 阅读全文
posted @ 2012-01-07 00:34 Seraph2012 阅读(144) 评论(0) 推荐(0)
摘要: 2011-12-31 19:37:25地址:http://acm.hdu.edu.cn/showproblem.php?pid=2539题意:中文。有点点麻烦的模拟。代码:# include <stdio.h># include <string.h>char str[110] ;int goal[20] ;int judge (char s[]){ int len = strlen(s) ; if (len < 10) return 1 ; if (s[len-8] == ' ' && s[len-7] == 'n' 阅读全文
posted @ 2012-01-07 00:33 Seraph2012 阅读(127) 评论(0) 推荐(0)
摘要: 2011-12-31 20:09:16地址:http://acm.hdu.edu.cn/showproblem.php?pid=2511题意:中文。mark:递归。代码:# include <stdio.h>void gao(long long n, long long time, int s, int e){ int m = 6-s-e ; long long mid = (1LL<<(n-1)) ; if (time == mid) { printf ("%I64d %d %d\n", n, s, e) ; return ; } ... 阅读全文
posted @ 2012-01-07 00:33 Seraph2012 阅读(218) 评论(0) 推荐(0)
摘要: 2011-12-31 19:19:52地址:http://acm.hdu.edu.cn/showproblem.php?pid=2565题意:中文,模拟。代码:# include <stdio.h># include <string.h>char graph[100] ;void output (int n){ int i ; memset (graph, ' ', sizeof (graph)) ; for (i = 0 ; i < n ; i++) { memset(graph, ' ', sizeof(graph)) ; gr 阅读全文
posted @ 2012-01-07 00:28 Seraph2012 阅读(209) 评论(0) 推荐(0)
摘要: 2011-12-31 19:02:16地址:http://acm.hdu.edu.cn/showproblem.php?pid=2561题意:中文。mark:可以排序,不过也可以扫一遍。用a记录最小值,b记录次小值,更新。代码:# include <stdio.h>int main (){ int T, a, b, i, n, num ; scanf ("%d", &T) ; while (T--) { scanf ("%d", &n) ; a = b = 1000 ; for (i = 0 ; i < n ; i++) 阅读全文
posted @ 2012-01-07 00:27 Seraph2012 阅读(127) 评论(0) 推荐(0)
摘要: 2011-12-31 19:13:38地址:http://acm.hdu.edu.cn/showproblem.php?pid=2566题意:中文。。。mark:题目没给数据范围,实在蛋疼,水了一下。考虑到如果有n个硬币,全都是1或2,能组成[n,2n]区间内任何一个数。所以枚举面额为5的硬币个数,然后计算剩下的面额是否在剩下的1、2硬币组成的面额区间内。15ms。那个dp[]数组没用,一开始看错题了。代码:# include <stdio.h>int dp[] = {1, 1, 2, 3, 5, 9} ;int main (){ int T, i, n, m, nn, mm, a 阅读全文
posted @ 2012-01-07 00:27 Seraph2012 阅读(248) 评论(0) 推荐(0)
摘要: 2011-12-31 18:58:25地址:http://acm.hdu.edu.cn/showproblem.php?pid=2562题意:中文。有点不明确,其实就是第0个和第1个互换,第二个和第三个互换。。。代码:# include <stdio.h>char str[100] ;int main (){ int T, i ; scanf ("%d", &T) ; while (T--) { scanf ("%s%*c", str) ; for (i = 0 ; str[i] ; i+=2) printf ("%c%.. 阅读全文
posted @ 2012-01-07 00:25 Seraph2012 阅读(111) 评论(0) 推荐(0)
摘要: 2011-12-31 18:53:55地址:http://acm.hdu.edu.cn/showproblem.php?pid=2564题意:中文。。。没啥好说的,处理就行了。代码:# include <stdio.h>char str[1000] ;void output(char str[]){ int i ; for(i = 0 ; str[i] ; i++) { if ((i == 0 || str[i-1] == ' ') && str[i] != ' ') putchar (str[i] & 0xDF) ; }}i 阅读全文
posted @ 2012-01-07 00:24 Seraph2012 阅读(148) 评论(0) 推荐(0)
摘要: 2011-12-31 18:44:21地址:http://acm.hdu.edu.cn/showproblem.php?pid=1548题意:有一个奇怪的电梯,只有2个按钮,上和下。第i楼层有一个值Ki。假设在第i层,按上它会向上走Ki层,按下也一样。如果超过n层或少于1层,则原地不动。问从第a层到b层需要几次操作。mark:BFS之。代码:# include <stdio.h># include <string.h>int aa, bb, n ;int k[210] ;int q[210] ;int step[210] ;void bfs(){ int a, fron 阅读全文
posted @ 2012-01-07 00:23 Seraph2012 阅读(161) 评论(0) 推荐(0)
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 51 下一页