最短路
算法知识——最短路
K.X
啤酒、饮料、矿泉水
展开
-
HDU - 1874 畅通工程续 (最短路)
畅通工程续Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距...原创 2018-07-25 15:03:14 · 153 阅读 · 0 评论 -
POJ - 3268 Silver Cow Party (最短路)
Silver Cow PartyDescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X ...原创 2018-08-05 16:50:02 · 106 阅读 · 0 评论 -
POJ - 2387 Til the Cows Come Home (最短路:迪杰斯特拉)
Til the Cows Come HomeDescriptionBessie 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 mo...原创 2018-08-05 16:27:58 · 148 阅读 · 0 评论 -
POJ - 1860 Currency Exchange(Bellman-Ford、弗洛伊德)
Currency ExchangeDescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies ...原创 2018-07-28 08:46:41 · 186 阅读 · 0 评论 -
POJ - 1062 昂贵的聘礼 (迪杰斯特拉+限制)
昂贵的聘礼Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶...原创 2018-07-27 14:41:26 · 230 阅读 · 0 评论 -
POJ - 3259 Wormholes (弗洛伊德、Bellman-Ford)
WormholesDescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a o...原创 2018-07-26 17:41:04 · 184 阅读 · 0 评论 -
POJ - 1502 MPI Maelstrom (迪杰斯特拉)
MPI MaelstromDescriptionBIT has recently taken delivery of their new supercomputer, a 32 processor Apollo Odyssey distributed shared memory machine with a ...原创 2018-07-26 15:02:40 · 145 阅读 · 0 评论 -
POJ - 2253 Frogger(迪杰斯特拉变形)
FroggerDescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plan...原创 2018-07-26 14:58:34 · 180 阅读 · 0 评论 -
最短路算法理解
最短路算法理解对于最短路的学习,主要学习了弗洛伊德Floyd算法、迪杰斯特拉Dijkstra算法、Bellman-Ford算法、自己又在网上看了一些spfa求最短路;对于Bellman-Ford的队列优化建立邻接表自己没有理解好。弗洛伊德算法对于求最短路是最容易理解的,直接五行代码就能够实现,对于每个点都进行绕行判...原创 2018-07-28 17:31:24 · 199 阅读 · 0 评论 -
POJ - 3037 Skiing (spfa的bfs)
SkiingDescriptionBessie and the rest of Farmer John's cows are taking a trip this winter to go skiing. One day Bessie finds herself at the top left...原创 2018-07-28 15:50:12 · 132 阅读 · 0 评论 -
POJ - 1797 Heavy Transportation (迪杰斯特拉变形)
Heavy TransportationDescriptionBackgroundHugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever ...原创 2018-07-25 17:10:28 · 132 阅读 · 0 评论 -
HDU - 2544 最短路
最短路Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是...原创 2018-07-25 15:07:01 · 120 阅读 · 0 评论 -
迪杰斯特拉最短路径(含路径输出)
迪杰斯特拉最短路径(含路径输出)模版:输入输入的第一行包含2个正整数n和s,表示图中共有n个顶点,且源点为s。其中n不超过50,s小于n。以后的n行中每行有n个用空格隔开的整数。对于第i行的第j个整数,如果大于0,则表示第i个顶点有指向第j个顶点的有向边,且权值为对应的整数值;如果这个整数为0,则表示没有i指向j的有向...原创 2019-10-18 15:54:18 · 1555 阅读 · 0 评论