
图论_最短路
SCUT_Pein
这个作者很懒,什么都没留下…
展开
-
HDU2851--Lode Runner--最短路
DescriptionLode Runner is a famous game, I think you played in your childhood.Ok, now, I simple the problem. In the game, it has N horizontal roads, the ladders always stay at right side v原创 2013-02-03 11:27:27 · 710 阅读 · 0 评论 -
POJ3635--Full Tank?(优先队列+最短路)
DescriptionAfter going through the receipts from your car trip through Europe this summer, you realised that the gas prices varied between the cities you visited. Maybe you could have saved some原创 2014-04-28 19:24:36 · 1184 阅读 · 0 评论 -
Electric Car Rally--最短路SPFA
In an attempt to demonstrate the practicality of electric cars, ElecCarCo is sponsoring a cross-country road rally. There are n charging stations for the rally where cars may check in and charge their原创 2014-03-16 14:57:31 · 1693 阅读 · 0 评论 -
POJ1125--Stockbroker Grapevine
DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge原创 2013-05-22 15:18:23 · 652 阅读 · 0 评论 -
POJ2066--一个人的旅行
Problem Description虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电影,去阳明山上看海芋,去纽约纯粹看雪景,去巴黎喝咖啡写信,去北京探望孟姜女……眼看寒假就快到了,这么一大段时原创 2013-04-29 21:27:56 · 1099 阅读 · 0 评论 -
HDU3790--最短路径问题
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-04-29 17:16:58 · 3499 阅读 · 0 评论 -
POJ3259--Wormholes--Bellman-Ford算法经典题
DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination a原创 2013-02-08 17:43:44 · 681 阅读 · 0 评论 -
Discrete Speed--最短路
ConstraintsTime Limit: 2 secs, Memory Limit: 256 MB , Special Judge DescriptionConsider car trips in a country where there is no friction. Cars in this country do not have engines. Once a car原创 2013-03-18 17:10:33 · 1179 阅读 · 0 评论 -
HDU1874--畅通工程续--最短路
Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input本题目包含多组数据,请处理到文件结束。每组数据第一原创 2013-02-04 14:57:31 · 493 阅读 · 0 评论 -
POJ1062--昂贵的聘礼--DFS
Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换原创 2013-02-20 12:52:02 · 606 阅读 · 0 评论 -
Bellman-Ford算法总结
本文主要摘自刘汝佳的《算法竞赛入门经典》,我只是加上看时的一些感悟。。Bellman-Ford算法主要用于处理含负权的图,先证明下,如果含负权的图最短路存在,一定存在一个不含环的最短路。。理由如下: 在边权可正可负的图中,环只有零环,正环和负环3种,如果包含零环或正环,去掉以后路径不会变长,如果包含负环,则意味着最短路不存在(因为可以无限跑负环)原创 2013-02-08 15:34:08 · 1275 阅读 · 0 评论 -
POJ2387--Til the Cows Come Home--Dijkstra算法裸题
DescriptionBessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she w原创 2013-02-08 01:10:40 · 956 阅读 · 0 评论 -
poj1125--Stockbroker Grapevine--Floyd算法
DescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge i原创 2013-02-10 10:05:44 · 530 阅读 · 0 评论 -
poj2240--Arbitrage--Bellmand-Ford算法
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 Dollar bu原创 2013-02-08 23:56:54 · 491 阅读 · 0 评论 -
Dijkstra算法总结
此文来源于刘汝佳的《算法竞赛入门经典》,我只是加上了我看的时候的一些备注。。Dijkstra算法,可用于计算正权图上的单源最短路(即SSSP),该算法适用于有向图和无向图。以下是从单源点出发,求到所有节点的最短路的伪代码,假设途中有n个点。清楚所有点的标号;设d[0]=0,其他d[i]=inf;循环n次//一:{ 在所有未标号节点中,选出d值最小的节点x;//原创 2013-02-07 23:47:54 · 1051 阅读 · 0 评论 -
HDU2962--Trucking最短路
DescriptionA certain local trucking company would like to transport some goods on a cargo truck from one place to another. It is desirable to transport as much goods as possible each trip. Unfortu原创 2013-02-03 20:53:22 · 589 阅读 · 0 评论 -
CF449B-- Jzzhu and Cities
Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of A. Also there are mroads connecting the cities. One can go from city ui to vi原创 2014-07-21 20:31:12 · 961 阅读 · 0 评论