2012年4月13日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1879最小生成树。。。m,n又看反了。。。无语ingView Code #include #include #include int idx[1000000];struct node{ int a,b,cos... 阅读全文
posted @ 2012-04-13 13:09 LegendaryAC 阅读(141) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1863裸的最小生成树,只需多判断一下是否连通,我用的方法是看是否只有一个根节点。ps:m和n写反了,害我查了1h啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊View Code #include #include #include... 阅读全文
posted @ 2012-04-13 10:12 LegendaryAC 阅读(200) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1233最小生成树,查找根节点的函数里面等号写成赋值号,查了半个小时、、、View Code #include #include #define N 110int idx[N];struct node{ int... 阅读全文
posted @ 2012-04-13 09:06 LegendaryAC 阅读(137) 评论(0) 推荐(0) 编辑

2012年4月12日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1202刚开始没看到输入实数。。。汗、、、View Code #include <stdio.h>int main(){ double s[100],p[100]; int n,i; double ss,sp; int cnt; while(~scanf("%d",&n)) { cnt=ss=sp=0; for(i=0;i<n;i++) { scanf("%lf%lf",s+i,p+i); ... 阅读全文
posted @ 2012-04-12 00:10 LegendaryAC 阅读(188) 评论(0) 推荐(0) 编辑

2012年4月11日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1248我乱搞的,标准做法01背包View Code #include <stdio.h>int test(int n){ if(n<150)return n; if(n>200&&n<300)return n-200; return n%50;}int main(){ int t,n; scanf("%d",&t); while(t--) { scanf("%d",&n); printf("%d\n 阅读全文
posted @ 2012-04-11 23:49 LegendaryAC 阅读(189) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1234和祖宗随机题号PK,由于这题first和end的初值赋反了,导致调试10分钟,最后以惨败收场。。。View Code #include <stdio.h>#include <string.h>#define INF 100000000int main(){ int t,n,i; int hb,mb,sb; int he,me,se; int first,end; char name[2][200],namec[200]; scanf("%d",&t); 阅读全文
posted @ 2012-04-11 22:29 LegendaryAC 阅读(355) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1181直接bfs,等号写成赋值了,wa两次。。。View Code #include <stdio.h>#include <string.h>char s[200];char graph[50][50];char vis[50];int q[50];int bfs(){ int front=0,rear=1; int ch,i; q[0]=1; while(front<rear) { ch=q[front++]; if(ch=='m'-'a')re 阅读全文
posted @ 2012-04-11 13:04 LegendaryAC 阅读(204) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2116判断两个k位带符号数的和有木有溢出。判断的时候注意不能用两个数的和判断,否则溢出的话会有bug。这里的方法是用最值减其中一个数,再和另一个数比较。View Code #include <stdio.h>int k;__int64 a,b;__int64 pow(int x,int y){ int i; __int64 s=1; for(i=0;i<y;i++) s*=x; return s;}#define MAX pow(2,63) int test(){ ... 阅读全文
posted @ 2012-04-11 12:33 LegendaryAC 阅读(244) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1283模拟View Code #include <stdio.h>int main() { int m1,m2,r1,r2,r3,i; char s[300]; while(~scanf("%d%d",&m1,&m2)) { scanf("%s",s); r1=r2=r3=0; for(i=0;s[i];i++) { switch(s[i]) { ... 阅读全文
posted @ 2012-04-11 00:23 LegendaryAC 阅读(213) 评论(0) 推荐(0) 编辑

2012年4月10日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2552数学推导View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>int main(){ int t; scanf("%d",&t); while(t--) { scanf("%*lf%*lf"); printf("1\n"); } return 0;} 阅读全文
posted @ 2012-04-10 17:31 LegendaryAC 阅读(169) 评论(0) 推荐(0) 编辑