
最小生成树
菜鸟起航
这个作者很懒,什么都没留下…
展开
-
hdu 2122 Ice_cream’s world III
简单最小生成树 #include #include #define inf 0x3fffffff int f[1010],n,map[1010][1010]; struct op { int x,y,w; }p[10100]; int find(int a) { if(a!=f[a]) f[a]=find(f[a]); return原创 2013-04-23 10:37:49 · 636 阅读 · 0 评论 -
hdu 1233 还是畅通工程
#include #include #include int m,n,f[100]; struct mapy { int x,y,len; }map[5000]; int cmp(const void *a,const void *b) { return (*(struct mapy *)a).len-(*(struct mapy *)b).len; } int find(int原创 2013-04-18 18:23:00 · 460 阅读 · 0 评论 -
hdu 2682 Tree
最小生成树水题 #include #include #include int num,n,a[610]; int f[610]; bool prim[2000010]; struct eadge { int st,end,w; }e[180000]; int MIN(int a,int b) { if(a>b)return b原创 2013-05-05 15:51:51 · 839 阅读 · 0 评论 -
zoj 2326
最小生成树水题 #include #include #include int f[500]; int find(int a) { if(a!=f[a]) f[a]=find(f[a]); return f[a]; } struct op { int x,y; double w; }p[500]; int cmp(const void *a,co原创 2013-06-09 20:43:47 · 767 阅读 · 0 评论 -
zoj 1406 hdu 1301
最小生成树 #include #include int m,n,f[27]; struct mapy { int x,y,len; }map[1000]; int cmp(const void *a,const void *b) { return (*(struct mapy *)a).len-(*(struct mapy *)b).len; }原创 2013-06-09 20:47:02 · 824 阅读 · 0 评论 -
poj 1789 (最小生成树)
题意:给出n个卡车,每个卡车的类型是七个字符组成的,一种卡车可以从另一种卡车派生来的,代价是两种卡车间类型不同字符的个数,求出这n中卡车派生的最小代价,n种车有一 种是开始就有的,n-1种是派生出来的。 思路:因为刚开始有一种卡车,所以就是加n-1条把所有车连起来,就是最小生成树了。。 #include #include #include const int N=2原创 2013-09-18 21:09:31 · 957 阅读 · 0 评论