POJ 1258 Agri-Net(Prim)
2021-06-17 11:04
标签:between min minimum 0ms limit connect oid lang mit 题目网址:http://poj.org/problem?id=1258 题目: Description Input Output Sample Input Sample Output 最小生成树水题~因为点数比较少,而且题目给的是邻接矩阵 所以用了Prim算法。 代码: POJ 1258 Agri-Net(Prim) 标签:between min minimum 0ms limit connect oid lang mit 原文地址:http://www.cnblogs.com/uniles/p/7265990.html
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 60004
Accepted: 24855
Farmer John ordered a high speed connection for his farm and is going to share his connectivity with the other farmers. To minimize cost, he wants to lay the minimum amount of optical fiber to connect his farm to all the other farms.
Given a list of how much fiber it takes to connect each pair of farms, you must find the minimum amount of fiber needed to connect them all together. Each farm must connect to some other farm such that a packet can flow from any one farm to any other farm.
The distance between any two farms will not exceed 100,000. 4
0 4 9 21
4 0 8 17
9 8 0 16
21 17 16 0
28
1 #include
上一篇:关于AJAX 第七篇
下一篇:php 代码设置跳转