码迷,mamicode.com
首页 >  
搜索关键字:highways    ( 182个结果
POJ 2485 Highways (最小生成树prim)
题目大意: 有一个岛国,没有高速公路,交通非常困难。政府意识到了这一问题,他们计划建造一些高速公路,这样可以使任何一对城镇都不离开公路系统。所有公路都是沿直线建造并且是双向的。政府想降低花费,所以想找到一种建造方案,能连接所有的城镇,并且公路的总长度最小。注意题目求的是最小生成树最长的那条边。#i....
分类:其他好文   时间:2015-09-17 19:00:59    阅读次数:163
pat1033. To Fill or Not to Fill (25)
1033. To Fill or Not to Fill (25)时间限制10 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者ZHANG, GuochuanWith highways available, driving a car from Hangzhou t...
分类:其他好文   时间:2015-09-07 10:48:41    阅读次数:193
POJ 2485 Highways
题意:给一个完全图,问最小生成树的最大边多大。解法:Kruskal。代码:#include#include#include#include#include#include#include#include#include#include#include#include#include#include#...
分类:其他好文   时间:2015-09-02 13:24:24    阅读次数:134
poj 2485 Highways
题目连接http://poj.org/problem?id=2485HighwaysDescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. ...
分类:其他好文   时间:2015-08-31 17:18:27    阅读次数:233
pat1030. Travel Plan (30)
1030. Travel Plan (30)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA traveler's map gives the distances between cities along the highways...
分类:其他好文   时间:2015-08-28 22:56:46    阅读次数:146
1030. Travel Plan (30)
原题如下: A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the sh...
分类:其他好文   时间:2015-08-25 19:34:41    阅读次数:194
PAT 1030. Travel Plan (30)
1030. Travel Plan (30)A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supp...
分类:其他好文   时间:2015-08-20 22:25:17    阅读次数:220
poj 2485:Highways
最基础的prim算法 让我们来分析一下prim的思路 给两个数组 一个二维的 以邻接矩阵的形式来表示图 一个一维的 用来表示每个节点到当前树的距离 关键看prim函数 因为每一个点最后都在树里面的 所以我先把第一个节点放进去(这个无所谓,随便你放哪一个) 然后把每个节点到树的距离更新出来(就是邻接矩阵中每个点到第一个节点的距离) 然后我进行一轮for循环 把到树的距离最小的...
分类:其他好文   时间:2015-08-18 16:28:22    阅读次数:166
Gym - 100203H Highways 最小生成树
题意:平面上n个点修路,已经修好了m条,再修若干条使得点之间连通,求最小代价的方案。思路:基本上是裸的最小生成树了,我这里存边直接存在multyset了,取的时候也比较方便,我本来就是这么考虑的,队友打了一发朴素的排序的超时了。 1 #include 2 #include 3 #inclu...
分类:其他好文   时间:2015-08-16 00:32:31    阅读次数:133
Codeforces Gym 100203H Highways 最小生成树
原题链接:http://codeforces.com/gym/100203/attachments/download/1702/statements.pdf题解给你平面上若干点,生成一颗完全图,让你生成一颗最小生成树。模板题。图中已经有了的边要将权值置0。代码是队友写的。代码#include #in...
分类:其他好文   时间:2015-08-15 22:50:33    阅读次数:163
182条   上一页 1 ... 9 10 11 12 13 ... 19 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!