![](https://img-blog.csdnimg.cn/2019091813595558.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
算法-prim
文章平均质量分 54
prim
Wonder-King
有好奇心,什么都想学一点。
展开
-
HDU3371 Connect the Cities(prim)
Connect the CitiesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24887 Accepted Submission(s): 5746Problem DescriptionIn 2100, since ...原创 2018-08-28 10:40:25 · 202 阅读 · 0 评论 -
HDU1102 Constructing Roads(最小生成树prim算法)
Constructing RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28801 Accepted Submission(s): 10978Problem DescriptionThere are N vi...原创 2018-08-27 20:23:46 · 218 阅读 · 0 评论 -
对prim算法的理解
练习了两天的prim算法,谈谈对prim算法的理解。prim算法解决的是需要求最小生成树的问题,也就是求一个连通图连通的最小权值问题。具体操作如下:首先你需要建图,申请一个二维数组存点,如果点过多的话,图是建不起来,二维数组申请不出来,所以点太多不适合用这个算法。i到j连通的表示:map[i][j]=map[j][i]=权值,图里当i=j时,也就是自己到自己的距离应该是0。如果两个点不...原创 2018-08-28 17:04:24 · 2928 阅读 · 1 评论 -
POJ1751 Highways(prim打印边)
HighwaysTime Limit: 1000MS Memory Limit: 10000K Total Submissions: 21195 Accepted: 6256 Special Judge DescriptionThe island nation of Flatopia is perfectly flat. Unfort...原创 2018-08-29 09:19:25 · 222 阅读 · 0 评论 -
51Nod1212 无向图最小生成树
#include<iostream>#include<cstring>#include<cstdio>using namespace std;int map[1001][1001];int d[1001];int visit[1001];const int INF=1<<30;int main(){ int i,j,m,n;...原创 2018-11-16 12:54:57 · 216 阅读 · 0 评论