![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最小生成树
GUESSERR
这个作者很懒,什么都没留下…
展开
-
Teen Girl Squad UVA - 11183
Teen Girl Squad UVA - 11183题意:就是0能到所有点的最小生成树,朱刘算法(最小树形图)Sample Input4210 1 10211 0 10440 1 100 2 101 3 202 3 30440 1 101 2 202 0 302 3 100Sample OutputCase #1: 10Case #2: Possums!Case #3: 40Case #4: 130代码:#include <stdio.h原创 2020-11-27 09:52:08 · 887 阅读 · 0 评论 -
Command Network POJ - 3164(最小树形图/朱刘算法)
Command Network POJ - 3164题意:1到所有点的最短距离,有向,最短,最小树形图(朱刘算法),板子题。不会的点链接。学吧!挺简单的。注意:别交G++,用C++交原因如下: After a long lasting war on words, a war on arms finally breaks out between littleken’s and KnuthOcean’s kingdoms. A sudden and violent assault by K原创 2020-11-27 00:36:43 · 138 阅读 · 0 评论 -
P4716 【模板】最小树形图(朱刘算法模板题)
P4716 【模板】最小树形图输入输出样例输入 #14 6 11 2 31 3 14 1 24 2 23 2 13 4 1输出 #13输入 #24 6 31 2 31 3 14 1 24 2 23 2 13 4 1输出 #24输入 #34 6 21 2 31 3 14 1 24 2 23 2 13 4 1输出 #31总结头一次了解到朱刘算法,半伪代码:while(true){ 步骤一:找到除了根节点外每个点被指向的最短距离原创 2020-11-26 22:35:30 · 318 阅读 · 0 评论 -
ACM Contest and Blackout EOlymp - 1107
ACM Contest and Blackout EOlymp - 1107 In order to prepare the “The First National ACM School Contest” (in 20??) the major of the city decided to provide all the schools with a reliable source of power. (The major is really afraid of blackoutsJ). So, in原创 2020-11-24 13:47:08 · 106 阅读 · 1 评论 -
Qin Shi Huang‘s National Road System HDU - 4081
Qin Shi Huang’s National Road System HDU - 4081 During the Warring States Period of ancient China(476 BC to 221 BC), there were seven kingdoms in China ---- they were Qi, Chu, Yan, Han, Zhao, Wei and Qin. Ying Zheng was the king of the kingdom Qin. Throu原创 2020-11-24 00:38:59 · 411 阅读 · 0 评论 -
The Unique MST POJ - 1679
The Unique MST Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, say T = (V’, E’), with the followi原创 2020-11-23 19:52:22 · 96 阅读 · 0 评论 -
037:Wormholes
037:WormholesBellman-Ford思路:采用dp,对每一条线进行更新,使其值为最小,循环n-1次,使所有点处于相连接状态,在最后一次循环中,只需找到他们可以从此点到下一个点,其值比上次可以变小,即可。否者,为NO代码:#include<iostream>#include <cstdio>#include <cmath>#includ...原创 2020-02-26 15:31:52 · 141 阅读 · 0 评论 -
1258:Agri-Net
1258:Agri-Net弗洛伊德思路:先找到与1相连最短的那条路,然后再更新与1和刚才相连的点每个与其他点最短的路存储,然后再找到下一个点,再找到这三个点与其他点最短路存储,以此类推。代码:#include<iostream>#include <cstdio>#include <cmath>#include <cstring>#in...原创 2020-02-21 20:31:07 · 1328 阅读 · 0 评论