![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最小生成树
文章平均质量分 66
Unin88
这个作者很懒,什么都没留下…
展开
-
HDU 1879 继续畅通工程
http://acm.hdu.edu.cn/showproblem.php?pid=1879 #include #include #include #include using namespace std; int father[110],n,m; struct node{ int from,to,cost; }edge[5010]; void Init(){原创 2014-10-20 21:29:39 · 220 阅读 · 0 评论 -
hdu 1162 Eddy's picture
acm.hdu.edu.cn/showproblem.php?pid=1162 最小生成树水题 AC代码: #include #include #include #include #include using namespace std; const int MAX = 110; int n,m,father[MAX]; struct ink{ double x,y; }no原创 2015-01-04 16:26:03 · 308 阅读 · 0 评论 -
POJ 1258 Agri-Net
poj.org/problem?id=1258 Prim求解MST水题! AC代码: #include #include #include #include using namespace std; const int MAX = 110; const int INF = 0x3f3f3f3f; int n,ans,G[MAX][MAX]; int vis[MAX],dis[M原创 2015-01-04 15:10:16 · 297 阅读 · 0 评论 -
hdu 3371 Connect the Cities
Prim求解最小生成树 AC代码: #include #include #include #include #include using namespace std; const int MAX = 510; int G[MAX][MAX],ans; int good[110],dis[MAX],vis[MAX]; int n, m, k; void init(){ for(原创 2015-04-05 17:10:06 · 357 阅读 · 0 评论 -
hdu 3938 Portal
题意描述 简单的讲就是,给你一张无向图,求有多少条路径使得路径上的花费小于L,这里路径上的花费是这样规定的,a、b两点之间的多条路径中的最长的边最小值! 题目分析 因为考虑到数据的大小所以需采用离线算法先计算出结果后在统一输出结果。这里首先要从a到b的所有路径中筛选出这样一条路径(路径中的最长边是所有路径中最小),那么这就需要采用最小生成树kruskal的思想,那么任意两个集合A,B之间可以原创 2015-04-07 22:24:23 · 559 阅读 · 0 评论