
最短路
文章平均质量分 81
键盘上的舞者
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU1874:畅通工程续(最短路Dijkstra(n^2+nlogn)+Floyd+SPFA(堆栈+队列))
Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input本题目包含多组数据,请处理到文件结束。每组数据第一行包原创 2013-11-21 23:19:51 · 4965 阅读 · 2 评论 -
HDU1317:XYZZY(Floyd+Bellman)
Problem DescriptionIt has recently been discovered how to run open-source software on the Y-Crate gaming device. A number of enterprising designers have developed Advent-style games for deployment o原创 2013-12-03 21:34:31 · 2649 阅读 · 0 评论 -
HDU1535:Invitation Cards(SPFA)
Problem DescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, An原创 2013-12-03 21:53:38 · 3058 阅读 · 0 评论 -
HDU1546:Idiomatic Phrases Game(Dijkstra)
Problem DescriptionTom is playing a game called Idiomatic Phrases Game. An idiom consists of several Chinese characters and has a certain meaning. This game will give Tom two idioms. He should build原创 2013-12-03 21:57:54 · 2226 阅读 · 1 评论 -
HDU1690:Bus System(Floyd)
Problem DescriptionBecause of the huge population of China, public transportation is very important. Bus is an important transportation method in traditional public transportation system. And it’s s原创 2013-12-11 12:40:09 · 2057 阅读 · 1 评论 -
HDU1142:A Walk Through the Forest(Dijkstra+dfs)
Problem DescriptionJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even n原创 2013-12-11 21:39:20 · 2402 阅读 · 0 评论 -
HDU2923:Einbahnstrasse(Floyd)
Problem DescriptionEinbahnstra e (German for a one-way street) is a street on which vehicles should only move in one direction. One reason for having one-way streets is to facilitate a smoother f原创 2013-12-05 16:02:10 · 2721 阅读 · 1 评论 -
HDU1595:find the longest of the shortest(Dijkstra)
Problem DescriptionMarica is very angry with Mirko because he found a new girlfriend and she seeks revenge.Since she doesn't live in the same city, she started preparing for the long journey.We know原创 2013-12-06 19:43:53 · 2694 阅读 · 2 评论 -
POJ2499:Remmarguts' Date(第K短路 SPFA+A*)
Description"Good man never makes girls wait or breaks an appointment!" said the mandarin duck father. Softly touching his little ducks' head, he told them a story."Prince Remmarguts lives in h原创 2014-04-14 00:54:03 · 2425 阅读 · 0 评论 -
POJ3255:Roadblocks(次短路 SPFA+A星)
DescriptionBessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scenery alo原创 2014-04-14 22:47:59 · 2998 阅读 · 0 评论 -
Codeforces544D:Destroying Roads(最短路)
In some country there are exactly n cities and m bidirectional roads connecting the cities. Cities are numbered with integers from 1 to n. If cities a and b are connected by a road, then in an h原创 2015-05-15 13:51:14 · 2275 阅读 · 0 评论 -
HDU3631:Shortest Path(Floyd)
Problem DescriptionWhen YY was a boy and LMY was a girl, they trained for NOI (National Olympiad in Informatics) in GD team. One day, GD team’s coach, Prof. GUO asked them to solve the following sho原创 2013-12-10 19:58:14 · 1697 阅读 · 0 评论 -
ZOJ1221 && UVA567:Risk(Floyd)
Risk is a board game in which several opposing players attempt to conquer the world. The gameboard consists of a world map broken up into hypothetical countries. During a player's turn, armies station原创 2013-12-08 20:10:20 · 2677 阅读 · 0 评论 -
HDU1245:Saving James Bond(Floyd)
Problem DescriptionThis time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a原创 2013-11-29 23:55:40 · 2270 阅读 · 0 评论 -
HDU2066:一个人的旅行(Dijkstra)
Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女……眼看寒假就快到了,这么一大段时原创 2013-11-24 14:32:41 · 14482 阅读 · 0 评论 -
HDU2544:最短路(Dijkstra)
Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input输入包括多组数据。每组数据第一行是两个整数N、M(N输入保证至少存在1条商店到赛场的路线。 O原创 2013-11-24 14:28:08 · 1732 阅读 · 0 评论 -
HDU2112:HDU Today(Dijkstra)
Problem Description经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方转车,在原创 2013-11-25 16:09:42 · 1719 阅读 · 0 评论 -
HDU3790:最短路径问题(Dijkstra)
Problem Description给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。 Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点。n和m为0时输入结束。原创 2013-11-25 16:12:06 · 4745 阅读 · 0 评论 -
HDU1548:A strange lift(Dijkstra && BFS)
Problem DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 <= Ki <= N) on every floor.The lift have just two buttons: up and down.When yo原创 2013-11-25 19:56:57 · 10159 阅读 · 0 评论 -
HDU1599:find the mincost route(Floyd)
Problem Description杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,....VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在8600需要你帮他找一条这样的路线,并且花费越少越好。 Input第一行是原创 2013-11-26 22:30:56 · 1678 阅读 · 1 评论 -
HDU1217:Arbitrage(SPFA)
Problem DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US D原创 2013-11-25 22:35:08 · 2893 阅读 · 0 评论 -
HDU2680:Choose the best route(Dijkstra)
Problem DescriptionOne day , Kiki wants to visit one of her friends. As she is liable to carsickness , she wants to arrive at her friend’s home as soon as possible . Now give you a map of the city’s原创 2013-11-26 20:38:43 · 3212 阅读 · 0 评论 -
HDU2807:The Shortest Path(Floyd)
Problem DescriptionThere are N cities in the country. Each city is represent by a matrix size of M*M. If city A, B and C satisfy that A*B = C, we say that there is a road from A to C with distance 1原创 2013-11-26 16:46:03 · 2041 阅读 · 0 评论 -
HDU1596:find the safest road(Dijkstra)
Problem DescriptionXX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2)…*s(ek) e1,e2,ek是P 上的边 ,现在8600 想出去旅游,面对这这么多的路,他想找一条最安全的路。但是86原创 2013-11-27 18:24:27 · 2106 阅读 · 0 评论 -
HDU3339:In Action(Dijkstra+01背包)
Problem DescriptionSince 1945, when the first nuclear bomb was exploded by the Manhattan Project team in the US, the number of nuclear weapons have soared across the globe.Nowadays,the crazy boy原创 2013-11-29 23:56:43 · 2241 阅读 · 0 评论 -
CSU1659: Graph Center(最短路)
DescriptionThe center of a graph is the set of all vertices of minimum eccentricity, that is, the set of all vertices A where the greatest distance d(A,B) to other vertices B is minimal. Equival原创 2015-06-22 21:44:14 · 1265 阅读 · 0 评论