最小生成树
躺平平的弱鸡
IT界资深菜鸟。。
展开
-
hdu1162Eddy's picture
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1162 先计算出每对顶点的距离,然后就是最小生成树的模板。。。。 代码: #include #include #include #include using namespace std; #define inf 0x3f3f3f3f double dis[105][10原创 2016-03-30 18:49:52 · 236 阅读 · 0 评论 -
NYOJ38布线问题
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=38 任意选择一个起点求最小生成树,然后最后在加上某个花费最少的点,算法选择普里姆算法. #include #include #define inf 0x3f3f3f3f int mp[505][505]; int v,e; int ans; int d[505]原创 2016-04-14 19:22:53 · 633 阅读 · 0 评论 -
hdu1301Jungle Roads
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1301 最小生成树模板题。 代码: #include #include #define inf 0x3f3f3f3f int a[50][50]; int n; int d[50]; char s[10]; char s1[10]; int ans; int v[50原创 2016-05-06 23:43:50 · 254 阅读 · 0 评论