上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 51 下一页
摘要: 2011-12-22 17:22:12地址:http://acm.hdu.edu.cn/showproblem.php?pid=1069题意:有n种立方体,长宽高分别是x[i], y[i], z[i],每种数量无限。可以随意旋转。把他们垒起来,要求上面的立方体底面长和宽一定要分别小于下面立方体顶面的长和宽。问最高能垒多高。mark:一开始没看到数量无限,以为是单个的。想了好久不会做,后来看别人的解释才知道。每个方块扩展成3个,分别穷举出3边各为高的情况,排序,然后dp。本质是LIS。还蛮简单的。但是wa了n次,快折腾死我了。排序的策略我选择的是先x和x比,然后y和y比。但是我忽略了有x1< 阅读全文
posted @ 2012-01-06 23:26 Seraph2012 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 2011-12-23 03:58:02地址:http://acm.hdu.edu.cn/showproblem.php?pid=1847题意:中文。。。mark:是简单博弈。。但是不会博弈论表示鸭梨很大,好在题目数据不大,直接爆。代码:# include <stdio.h>int dp[1001] = {0, 1, 1, 0} ;int main (){ int i, j, n ; for (i = 4 ; i <= 1000 ; i++) for (j = 1 ; j <= i ; j<<=1) if (dp[i-j] == 0) dp[i] ... 阅读全文
posted @ 2012-01-06 23:26 Seraph2012 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 2011-12-21 11:49:05地址:http://acm.hdu.edu.cn/showproblem.php?pid=1087题意:有n个point,每次只能往后跳,而且只能跳到分数比当前的大的point。score是路径上所有point的和。求最大score。mark:dp。效率是O(n^2)。dp[i] = max{dp[j] + a[i]), 0<=j<=i-1。代码:# include <stdio.h>int a[1010], dp[1010] ;int max(int a, int b){return a>b?a:b;}int main () 阅读全文
posted @ 2012-01-06 23:25 Seraph2012 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 2011-12-21 11:00:01地址:http://acm.hdu.edu.cn/showproblem.php?pid=2108题意:中文,判断是否凸。代码:# include <stdio.h>typedef struct POINT{ int x, y ;}point ;point pt[1010] ;int n ;int direction (int x1, int y1, int x2, int y2){ return x1*y2 - x2*y1 ;}int test (){ int i ; pt[n] = pt[0], pt[n+1] = pt[1] ... 阅读全文
posted @ 2012-01-06 23:24 Seraph2012 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 2011-12-21 11:19:32地址:http://acm.hdu.edu.cn/showproblem.php?pid=2151题意:中文。mark:递推。dp[i][j]表示第i分钟在第j颗树上的走法。dp[i][j] = dp[i-1][j-1] + dp[i-1][j+1]。注意边界。代码:# include <stdio.h># include <string.h>int dp[110][110] ;int main (){ int n, p, m, t, i, j ; while (~scanf ("%d%d%d%d", & 阅读全文
posted @ 2012-01-06 23:24 Seraph2012 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 2011-12-21 10:39:00地址:http://acm.hdu.edu.cn/showproblem.php?pid=1391题意:给出坐标,输出坐标上的数字或No Number。代码:# include <stdio.h>int gao(int x, int y){ int ans ; if (x == y) return 2*x - (x&1) ; return gao(x, y+2) - 2 ;}int main (){ int T, x, y ; scanf ("%d", &T) ; while (T--) { sca... 阅读全文
posted @ 2012-01-06 23:23 Seraph2012 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 2011-12-21 09:46:27地址:http://acm.hdu.edu.cn/showproblem.php?pid=1785题意:中文。给点和原点连线与x轴夹角排序。代码:# include <stdio.h># include <stdlib.h>typedef struct point{ double x, y ;}point ;point pt[110] ;int cmp(const void *a, const void *b){ double x1 = ((point*)a)->x, y1 = ((point*)a)->y ; doub 阅读全文
posted @ 2012-01-06 23:22 Seraph2012 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 2011-12-21 10:28:36地址:http://acm.hdu.edu.cn/showproblem.php?pid=1035题意:从最上方的第pos列进入,按照迷宫指示走,N向上,D向下,W向左,E向右,输出最终的结果(走出迷宫or循环)。代码:# include <stdio.h># include <string.h>char map[110][110] ;int dp[110][110] ;int n, m, loop ;int gao(int x, int y, int step){ if (x < 0 || x >= n || y &l 阅读全文
posted @ 2012-01-06 23:22 Seraph2012 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 2011-12-21 02:10:08地址:http://acm.hdu.edu.cn/showproblem.php?pid=1859题意:中文。每次更新就OK。代码:# include <stdio.h>int min(int a, int b){return a<b?a:b;}int max(int a, int b){return a>b?a:b;}int main (){ int x, y, l, r, t, d ; while (scanf ("%d%d", &x, &y) && (x||y)) { l = 阅读全文
posted @ 2012-01-06 23:21 Seraph2012 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 2011-12-21 09:23:36地址:http://acm.hdu.edu.cn/showproblem.php?pid=1396题意:边长为n的大三角形含有边长大于等于1的小三角形多少个。mark:递推,分奇偶。考虑增加一列新的底边三角形时,头冲下的三角形和头冲上的三角形增加了多少个。代码:# include <stdio.h>int dp[510]= {0, 1} ;void init(){ int i ; for (i = 2; i <= 500 ; i++) { if (i & 1) dp[i] = dp[i-1] + (i*... 阅读全文
posted @ 2012-01-06 23:21 Seraph2012 阅读(283) 评论(0) 推荐(0) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 51 下一页