洛谷——P1195 口袋的天空
原题链接
这是一道简单的图论问题。首先,用n-k条边连成无环图,就有k棵树了,而题目的意思正是如此。利用Kruskal算法,就可以写了。
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int un[1010];
int n, m, k;
struct Cl {
int x, y, w;
}cl[10010];
boo
原创
2020-08-15 10:54:27 ·
113 阅读 ·
0 评论