andre_joy

导航

上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页

2012年7月11日

hdu 1847

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1847题意:中文……mark:wa了一次,题目看错了,以为是只能按照1,2,4……的顺序来取牌。 数据比较小,博弈问题,在纸上找到规律了,直接暴力破解了。代码:#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) ... 阅读全文

posted @ 2012-07-11 00:13 andre_joy 阅读(94) 评论(0) 推荐(0) 编辑

2012年7月10日

hdu 1069

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1069题意:给定若干个木块长宽高,长宽高可以自己调整,求堆积起来最高的高度。mark:枚举所有木块长宽高可能情况,简单dp。代码:#include <stdio.h>#include <stdlib.h>typedef struct{ int x,y,z;}block;int cmp1(const void *a, const void *b){ block *p = (block *)a, *q = (block *)b; if(p->x != q->x) retu 阅读全文

posted @ 2012-07-10 23:40 andre_joy 阅读(152) 评论(0) 推荐(0) 编辑

hdu 1087

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1087题意:只能走比当前旗子大的旗子,不能回头,求走过最大的旗子的和。mark:简单dp。代码:#include <stdio.h>#include <string.h>int main(){ int n,a[1010],dp[1010][2]; int i,j,max; while(scanf("%d", &n), n) { memset(dp, 0, sizeof(dp)); for(i = 0; i < n; i++) sc... 阅读全文

posted @ 2012-07-10 22:56 andre_joy 阅读(465) 评论(0) 推荐(0) 编辑

USACO milk

摘要: 题意:计算从农夫手中购买需要的牛奶的最小价格。mark:简单排序即可。代码:/*ID: andre_j2LANG: CTASK: milk*/#include <stdio.h>#include <stdlib.h>typedef struct{ int p,a;}farmer;int cmp(const void *c, const void *b){ farmer *f1 = (farmer *)c, *f2 = (farmer *)b; if(f1->p != f2->p) return f1->p - f2->p; return f2-& 阅读全文

posted @ 2012-07-10 21:51 andre_joy 阅读(93) 评论(0) 推荐(0) 编辑

2012年7月9日

USACO dualpal

摘要: 题意:寻找n个在2~10进制里面转换后至少有两次是回文数字的严格大于S的数字。mark:仔细一点就ok了。代码:/*ID: andre_j2LANG: CTASK: dualpal*/#include <stdio.h>#include <string.h>int dd(char a[]){ int i,j; j = strlen(a)-1; for(i = 0; i < j; i++,j--) if(a[i] != a[j]) return 0; return 1;}int pd(int n){ int m,i,j,f; char a[20]... 阅读全文

posted @ 2012-07-09 22:59 andre_joy 阅读(93) 评论(0) 推荐(0) 编辑

USACO palsquare

摘要: 题意:找1~300对应的平方数再转换成对应的进制后是回文数字的数。mark:扫描一遍,转换一遍,满足要求的输出。代码:/*ID: andre_j2LANG: CTASK: palsquare*/#include <stdio.h>#include <string.h>int pd(char a[]){ int n,i,j; n = strlen(a); for(i = 0, j = n-1; i < j; i++, j--) if(a[i] != a[j]) return 0; return 1;}void fout(char a[]){ int i... 阅读全文

posted @ 2012-07-09 22:30 andre_joy 阅读(89) 评论(0) 推荐(0) 编辑

USACO namesum

摘要: 题意:将数字转换成对应的字母。mark:把字典里面的数全部存在数组里面,然后每输入一次搜索一遍,看是否存在该数。代码:/*ID: andre_j2LANG: CTASK: namenum*/#include <stdio.h>#include <string.h>char a[5010][15],b[5010][15];main () { FILE *fdict = fopen("dict.txt", "r"); FILE *fin = fopen("namenum.in", "r"); F 阅读全文

posted @ 2012-07-09 15:24 andre_joy 阅读(120) 评论(0) 推荐(0) 编辑

USACO transform

摘要: 题意:将转换前字符串经过题目给出的7种方式转换成转换后的字符串。注意5是前三种跟第四种结合。mark:模拟一下就ok了~代码:/*ID: andre_j2LANG: CTASK: transform*/#include <stdio.h>#include <string.h>int i,j;int pp(char a[][15], char b[][15], int n){ int i; for(i = 0; i < n; i++) if(strcmp(a[i], b[i])) return 0; return 1;}void zh1(char a[][15],. 阅读全文

posted @ 2012-07-09 10:50 andre_joy 阅读(134) 评论(0) 推荐(0) 编辑

2012年7月8日

hdu 2151

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2151题意:中文……mark:递推。dp[i][j]代表第i时刻在第k棵树的方法数。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; int i,j; while(~scanf("%d%d%d%d", &n, &p, &m, &t)) { 阅读全文

posted @ 2012-07-08 23:46 andre_joy 阅读(121) 评论(0) 推荐(0) 编辑

hdu 2108

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=2108题意:给定一个多边形的每一个顶点坐标,判断它是否为凸多边形。mark:判断每两个向量的转向。wa了2次,tle了1次。把文件输入输出部分一起交了……代码:#include <stdio.h>int main(){ int n,x1,x2,x3,y1,y2,y3,f,x0,y0,x4,y4; while(scanf("%d", &n), n) { if(n < 3) { while(n--) scanf... 阅读全文

posted @ 2012-07-08 18:26 andre_joy 阅读(139) 评论(0) 推荐(0) 编辑

上一页 1 ··· 7 8 9 10 11 12 13 14 15 下一页