本文共 543 字,大约阅读时间需要 1 分钟。
题意:给出一个n(n<=100)结点的图,求苗条度(最大边减最小边的值)尽量小的生成树。
分析:枚举区间求最小生成树,不断更新ans
代码:
#include #include #include #include #include #include #include #include #include #include #include #include #define ll long long#define mod 1000000007#define mem(a) memset(a,0,sizeof(a))using namespace std;const int maxn = 5000 + 5 , inf = 0x3f3f3f3f ;struct edge{ int v,e,w; bool operator < (const edge&temp)const{ return w
转载于:https://www.cnblogs.com/seven7777777/p/10278730.html