码迷,mamicode.com
首页 >  
搜索关键字:jungle roads    ( 729个结果
poj 1724:ROADS(DFS + 剪枝)
ROADSTime Limit:1000MSMemory Limit:65536KTotal Submissions:10777Accepted:3961DescriptionN cities named with numbers 1 ... N are connected with one-way...
分类:其他好文   时间:2014-08-05 10:55:59    阅读次数:977
POJ--2421--Constructing Roads【最小生成树】
链接:http://poj.org/problem?id=2421 题意:n个村庄,告诉你任两个村庄间距离,要建一些路使得任两个村庄都可以互相到达,需要使花费最小,其中有q条路已经建了,求最小花费。 把已经建的路的权值改为0,再prim就行了。kruskal做的话,把建好的路用并查集合并,再kruskal就行了 #include #include #include #incl...
分类:其他好文   时间:2014-08-04 17:37:07    阅读次数:189
ZOJ 1655 Transport Goods
The HERO country is attacked by other country. The intruder is attacking the capital so other cities must send supports to the capital. There are some roads between the cities and the goods must be tr...
分类:其他好文   时间:2014-08-03 18:06:55    阅读次数:319
广大暑假训练1 E题 Paid Roads(poj 3411) 解题报告
题目链接:http://poj.org/problem?id=3411题目意思:N个city 由 m 条路连接,对于一条路(假设连接Cityia和 Cityb),如果从Citya 去 Cityb的途中,之前已经走过Cityc(可能会等于a),那么就可以交p的钱,否则之前未走过Cityc,就一定要交r...
分类:其他好文   时间:2014-08-02 01:33:23    阅读次数:209
poj 1724 ROADS (bfs+优先队列)
题目链接题意:在有费用k限制的条件下,求从1到n的最短距离,如果最短距离相同求费用最小的,边为有向边,其中可能有多个相同的源点和目标点,但是距离和费用不同。分析:用bfs和邻接表来把每一个边搜一下,因为用了优先队列,所以先到n的一定是最小的 。 1 #include 2 #include 3 #.....
分类:其他好文   时间:2014-08-01 22:59:42    阅读次数:247
poj 1251(最小生成树)
Description The Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the jungle overtakes roa...
分类:其他好文   时间:2014-08-01 16:14:51    阅读次数:277
ROADS+dijkstra的灵活运用+POJ
dijkstra算法的变形,用上优先队列+bfs求在花费限制的条件下的最短路。...
分类:其他好文   时间:2014-07-31 17:17:27    阅读次数:205
poj 1724 ROADS 解题报告
题目链接:http://poj.org/problem?id=1724题目意思:给出一个含有N个点(编号从1~N)、R条边的有向图。Bob 有 K 那么多的金钱,需要找一条从顶点1到顶点N的路径(每条边需要一定的花费),前提是这个总花费 2 #include 3 #include 4 usin...
分类:其他好文   时间:2014-07-30 20:19:54    阅读次数:241
HDU 1102 Constructing Roads, Prim+优先队列
图论 最小生成树算法,Prim+优先队列实现...
分类:其他好文   时间:2014-07-30 12:14:23    阅读次数:216
POJ 1947 Rebuilding Roads
题目意思:有N 个节点形成树状结构,现在想知道。给定一个人P删除最少的边使得形成一个子树子树的节点有P 个节点;很明显的树形DP[i][j] I为根子树形成j个节点最少减多少; 依赖性01问题,只不过这个合并时候的输的初始化不好想;给出代码加注释;#include #include #incl...
分类:其他好文   时间:2014-07-30 11:31:43    阅读次数:204
729条   上一页 1 ... 66 67 68 69 70 ... 73 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!