poj 1251 && hdu 1301 Sample Input 9 //n 结点数A 2 B 12 I 25B 3 C 10 H 40 I 8C 2 D 18 G 55D 1 E 44E 2 F 60 G 38F 0G 1 H 35H 1 I 353A 2 B 10 C 40B 1 C 200Sample Output 21630 prim算法 # include <iostream> # include <cstdio> # include <cstr…
Constructing Roads Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2421 Appoint description: System Crawler (2015-05-27) Description There are N villages, which are numbered from 1 to N, and y…
题意:有几个村庄,要修最短的路,使得这几个村庄连通.但是现在已经有了几条路,求在已有路径上还要修至少多长的路. 分析:用Prim求最小生成树,将已有路径的长度置为0,由于0是最小的长度,所以一定会被Prim选中加入最小生成树. package Map; import java.util.Scanner; /** * Prime */ public class Poj_2421_Prim { static int MAXVEX = 200; static int n, m; static int[…
链接: http://poj.org/problem?id=2421 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 21130 Accepted: 8924 Description There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can…
Building a Space Station Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4400 Accepted: 2255 Description You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are ex…