andre_joy

导航

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

2012年7月5日

hdu 1391

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1391题意:按图输出图上数字。mark:模仿图形里面数字变换特性。代码:#include <stdio.h>int a[5010][2];int main(){ int n,x,y,m; int i; a[0][0] = 0; a[1][1] = 1; i = m = 2; while(i < 5001) { a[i++][0] = m++; a[i--][0] = m++; a[i++][1] = m++; ... 阅读全文

posted @ 2012-07-05 23:48 andre_joy 阅读(111) 评论(0) 推荐(0) 编辑

hdu 1035

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1035题意:看小人是否能走出迷宫。mark:wa了一次,又是循环跳出条件出问题了……代码:#include <stdio.h>#include <string.h>int main(){ char a[15][15]; int m,n,s,sum,b[15][15]; int i,j,k; while(scanf("%d%d", &m, &n), m+n) { scanf("%d", &s); for(i = 0; 阅读全文

posted @ 2012-07-05 13:09 andre_joy 阅读(137) 评论(0) 推荐(0) 编辑

USACO milk2

摘要: 题意:n个农夫给n只羊喂奶,分别给出他们的起始时间和结束时间,求重叠的和没有重叠的最长时间。mark:wa了一次。变量max1忘记每次遇到不重叠的时候需要重新初始化了。。代码:/*ID: andre_j2LANG: CTASK: milk2*/#include <stdio.h>#include <stdlib.h>typedef struct{ int st,en;}fa;int cmp(const void *a, const void *b){ fa *p = (fa *)a, *q = (fa *)b; if(p->st != q->st) retu 阅读全文

posted @ 2012-07-05 01:40 andre_joy 阅读(273) 评论(0) 推荐(0) 编辑

2012年7月4日

hdu 1785

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1785题意:按原点到给定点的向量与x轴正方向夹角大小排序,夹角越小,实际越大。mark:wa了两次。。。题目说的是与x轴正方向的夹角。。代码:#include <stdio.h>#include <stdlib.h>typedef struct{ double x,y;}stu;int cmp(const void *a, const void *b){ stu *p = (stu *)a, *q = (stu *)b; double m; m = p->y*q->x 阅读全文

posted @ 2012-07-04 23:17 andre_joy 阅读(131) 评论(0) 推荐(0) 编辑

hdu 1396

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1396题意:等边三角形每一条边被分成n份后,总共有多少个等边三角形。mark:wa了一次,把问题想简单了……没考虑反着的大三角形,应该分奇偶考虑。代码:#include <stdio.h>int main(){ int i,m,a[501] = {0,0}, b[501] = {0,1}; m = 1; for(i = 2; i < 501; i++) { m += i; b[i] = b[i-1] + m; a[i] = a[i-2] ... 阅读全文

posted @ 2012-07-04 22:50 andre_joy 阅读(234) 评论(0) 推荐(0) 编辑

hdu 1859

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1859题意:中文……mark:就是找x,y中出现过的最大最小数。循环跳出条件需要注意~代码:#include <stdio.h>int main(){ int x1,x2,y1,y2,x,y; x1 = y1 = 232; x2 = y2 = -232; while(scanf("%d%d", &x, &y)) { if(!x && !y) { if(x1 == 232) break; printf("... 阅读全文

posted @ 2012-07-04 20:51 andre_joy 阅读(98) 评论(0) 推荐(0) 编辑

hdu 1716

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1716题意:中文……mark:只有四位数,直接暴力破了。。代码:#include <stdio.h>#include <stdlib.h>int cmp(const void *a, const void *b){ return *(int *)a - *(int *)b;}int main(){ int a[4],sum,p1,p2; int i,j,k,s,f; f = 0; while(scanf("%d%d%d%d", a, a+1, a+2, a+3 阅读全文

posted @ 2012-07-04 20:30 andre_joy 阅读(194) 评论(0) 推荐(0) 编辑

hdu 1256

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1256题意:中文……mark:写的中间就发现用自定义函数会少很多代码。。代码:#include <stdio.h>int main(){ int n,m,p,s; int i,j,k; char a; scanf("%d%*c", &n); k = 0; while(n-- && scanf("%c %d%*c", &a, &m)) { if(k++) puts(""); s = m/6+1; 阅读全文

posted @ 2012-07-04 20:04 andre_joy 阅读(134) 评论(0) 推荐(0) 编辑

hdu 1088

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1088题意:按要求输出html文件。mark:pe了无数次,主要是临界问题的考虑,还有是要考虑'\t'。代码:#include <stdio.h>int zh(char a){ if(a == '<') return 1; if(a == ' ' || a == '\n' || a == '\t') return 2; return 3;}int main(){// freopen("in1.tx 阅读全文

posted @ 2012-07-04 14:50 andre_joy 阅读(235) 评论(0) 推荐(0) 编辑

2012年7月3日

hdu 1197

摘要: 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1197题意:求一个数转换成10,12,16进制后各个位上的数的和是否相等。mark:模拟进制转换。代码:#include <stdio.h>int zh(int a, int n){ int sum = 0; while(a) { sum += a%n; a /= n; } return sum;}int main(){ int m; for(m = 2992; m < 10000; m++) if(zh(m, 10) ... 阅读全文

posted @ 2012-07-03 23:34 andre_joy 阅读(113) 评论(0) 推荐(0) 编辑

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