首页 > TAG信息列表 > Jungle
Codeup100000622问题 E: Jungle Roads
题目描述: The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roads relentlessly, so the large road network is too expensive toPOJ - 1251 Jungle Roads (最小生成树&并查集
#include<iostream>#include<algorithm>using namespace std;int ans=0,tot=0;const int N = 1e5;int f[200];struct ac{ int v,u,w;}edge[N];bool cmp(ac a,ac b){ return a.w<b.w;}inline int find(int x){ if(x!=f[x])f[x]=find(f[x]);return f[x]Jungle Roads——最小生成树
题目链接 题意: 把各个岛屿看成一个点,求各个岛屿之间权值最小的路径(最小生成树) 对于数据 数据输入的第一行n代表岛屿的个数,当为0时程序结束。 接着n-1行开始为岛屿的编号,用大写字母表示,接着是一个整数k,表示与该岛屿连接的岛屿个数,然后该行输入m对数据 字母表示岛屿编号 接着一个整