上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 51 下一页
摘要: 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 阅读(133) 评论(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 阅读(115) 评论(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 阅读(209) 评论(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 阅读(200) 评论(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 阅读(115) 评论(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 阅读(238) 评论(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 阅读(104) 评论(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 阅读(139) 评论(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 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 2011-12-31 18:20:59地址:http://acm.hdu.edu.cn/showproblem.php?pid=2102题意:中文。。。mark:你大爷的WA+TLE一共11次才AC。做了至少8个小时。一开始以为是要在严格的T时刻到达才可以,考虑了不可回头和可回头两种情况,dfs之,TLE。。。然后加奇偶剪,还是TLE。之后搜了搜,发现时T时刻以内到都可以,然后拍了个BFS。WA。WA了n次以后才发现时空传送是一定要传送的,不是自己选可以传也可以不传的。然后还WA,想是不是真的要在T时刻才能过,然后加了奇偶剪枝(因为回头路的话可以无限延长时间),还WA。最后发现一个trick是 阅读全文
posted @ 2012-01-07 00:22 Seraph2012 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 51 下一页