2012年4月13日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2108几何计算,判断线段的转向。View Code #include <stdio.h>#include <string.h>#include <math.h>typedef struct point{ int x,y; }point;point kk[100000];int dis(point p1,point p2,point p3){ return (p3.x-p1.x)*(p2.y-p1.y)-(p2.x-p1.x)*(p3.y-p1.y);}int main(){ 阅读全文
posted @ 2012-04-13 23:29 LegendaryAC 阅读(182) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3783View Code #include <stdio.h>#include <stdlib.h>#include <string.h> int main(){ int n,i; int cntZ,cntO,cntJ; int len; char str[200]; while(gets(str)) { if(str[0]=='E')break; len=strlen(str); cntZ=cntO=cntJ=0; ... 阅读全文
posted @ 2012-04-13 22:31 LegendaryAC 阅读(221) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3782View Code #include <stdio.h>#include <stdlib.h>int main(){ int n; while(scanf("%d",&n),n) { int cnt=0; while(1) { if(n==1)break; if(n&1) n=(3*n+1)>>1; else n>>=1... 阅读全文
posted @ 2012-04-13 22:07 LegendaryAC 阅读(152) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3785View Code #include <stdio.h>#include <stdlib.h>#define INF 200000000int cmp(const void*a,const void*b){ return *(int*)b-*(int*)a;}int a[110000];int main(){ int n,m; while(scanf("%d%d",&n,&m),(n||m)) { for(int i=0;i<100001 阅读全文
posted @ 2012-04-13 22:02 LegendaryAC 阅读(214) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2399最短路最小生成树神马的几道题纠结了几个小时,换换心情吧。直接按题目要求做。View Code #include <stdio.h>#include <string.h>int main(){ char str[300]; int len,i; int s,f,cnt; while(gets(str)) { len=strlen(str); s=f=cnt=0; for(i=0;i<len;i++) { ... 阅读全文
posted @ 2012-04-13 13:49 LegendaryAC 阅读(394) 评论(0) 推荐(0) 编辑
 
摘要: 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) 编辑