最短路 次短路
文章平均质量分 65
路径
依旧Lily
发自己的光就好,别去吹灭别人的灯。
展开
-
最短路(Dijkstra算法模板—单源最短路)
在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗? Input 输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是赛场所在地,M则表示在成都有几条路。N=M=0表示输入结束。接下来M行,每行包括3个整数A,B,C(1<=A,B&原创 2021-03-27 10:03:08 · 99 阅读 · 1 评论 -
Roadblocks(次短路)
Bessie 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 along the way. She has decided to take the second-shortest rather than the原创 2021-01-26 19:48:55 · 240 阅读 · 0 评论 -
Wormholes(Bellman-Ford最短路 模板题)
While 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 at a time that is BEFORE you entered the wormhole! Each of FJ’s farms co原创 2021-01-30 19:32:25 · 149 阅读 · 0 评论