最小生成树
Spark_007
Forward.
展开
-
Poj 1251 Jungle Roads -- 最小生成树
/* 题意:求最小生成树 分析:kruskal,注意一下输入,推荐用cin。 */ #include #include #include using namespace std; struct edge { int a,b; int len; }a[80]; int num; int p[30]; int root(int x) { if(p[x] == -原创 2013-08-27 19:29:16 · 666 阅读 · 0 评论 -
Poj 3723 Conscription -- 最大生成树(森林)
#include #include #include using namespace std; struct edge { int a,b; int d; }r[50010]; int p[20010]; int root(int x) { if(p[x]==x) return p[x]; return p[x] = root(p[x]); } void原创 2013-08-27 22:46:43 · 778 阅读 · 0 评论