题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1863
此题与hdoj1233解法一样http://blog.csdn.net/xuguangsoft/article/details/7879572
#include <iostream>
#include <algorithm>
using namespace std;
int city[101];
struct Road {
int c1, c2, cost;
};
Road road[5051];
int cmp(const Road a, const Road b)
{
return a.cost < b.cost;
}
int Find(const int n)
{
if (city[n] == -1)
return n;
return city[n] = Find(city[n]);
}
int Merge(const int a, const int b)
{
int x = Find(a)......
阅读全文