![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
普里姆
文章平均质量分 85
wangyu666777888
只有自己能成就自己。。。
展开
-
#1097 : 最小生成树一·Prim算法
时间限制:10000ms单点时限:1000ms内存限制:256MB描述最近,小Hi很喜欢玩的一款游戏模拟城市开放出了新Mod,在这个Mod中,玩家可以拥有不止一个城市了!但是,问题也接踵而来——小Hi现在手上拥有N座城市,且已知这N座城市中任意两座城市之间建造道路所需要的费用,小Hi希望知道,最少花费多少就可以使得任意两座城市都可以通过所建造的道路互相到原创 2015-07-26 20:43:18 · 355 阅读 · 0 评论 -
Bad Cowtractors
DescriptionBessie has been hired to build a cheap internet network among Farmer John's N (2 <= N <= 1,000) barns that are conveniently numbered 1..N. FJ has already done some surveying, and found M原创 2015-08-20 12:04:44 · 459 阅读 · 0 评论 -
Borg Maze
DescriptionThe Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg ci原创 2015-08-19 22:52:50 · 1107 阅读 · 0 评论 -
Eddy's picture
Problem DescriptionEddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his small room, and he usually puts out his newest pictu原创 2015-08-05 15:10:38 · 292 阅读 · 0 评论 -
还是畅通工程
roblem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 当N为0时,输入结束原创 2015-08-05 12:25:57 · 288 阅读 · 0 评论 -
Constructing Roads
Problem DescriptionThere are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connec原创 2015-08-05 11:13:56 · 297 阅读 · 0 评论 -
Outlets
Problem DescriptionIn China, foreign brand commodities are often much more expensive than abroad. The main reason is that we Chinese people tend to think foreign things are better and we are willing原创 2015-07-28 17:45:20 · 316 阅读 · 0 评论 -
修路方案(次小生成树)
描述南将军率领着许多部队,它们分别驻扎在N个不同的城市里,这些城市分别编号1~N,由于交通不太便利,南将军准备修路。现在已经知道哪些城市之间可以修路,如果修路,花费是多少。现在,军师小工已经找到了一种修路的方案,能够使各个城市都联通起来,而且花费最少。但是,南将军说,这个修路方案所拼成的图案很不吉利,想让小工计算一下是否存在另外一种方案花费和刚才的方案一样,现在你来原创 2015-07-28 18:42:35 · 486 阅读 · 0 评论 -
继续畅通工程
Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最低成本。 Input测试输入包含若干测试用例。每个测试用例的第1行给出村庄数目N ( 1原创 2015-07-27 20:06:27 · 297 阅读 · 0 评论 -
#1109 : 最小生成树三·堆优化的Prim算法
时间限制:10000ms单点时限:1000ms内存限制:256MB描述回到两个星期之前,在成功的使用Kruscal算法解决了问题之后,小Ho产生了一个疑问,究竟这样的算法在稀疏图上比Prim优化之处在哪里呢?提示:没有无缘无故的优化!输入每个测试点(输入文件)有且仅有一组测试数据。在一组测试数据中:第1行为2个整数N、M,表示小Hi拥原创 2015-07-27 17:20:39 · 767 阅读 · 0 评论 -
The Unique MST
DescriptionGiven 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 i原创 2015-08-20 13:09:45 · 573 阅读 · 0 评论