andre_joy

导航

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) 编辑