![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最短路径
tjx_belief
这个作者很懒,什么都没留下…
展开
-
POJ - 1797 Heavy Transportation
原题链接Background Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his原创 2017-02-18 13:18:25 · 180 阅读 · 0 评论 -
CodeForces - 601A The Two Routes
原题链接思路: 连通图中1和n之间是直接连接的,该路是某种交通工具的最短路径(为1),只需用dijkstra求出另一种交通工具的最短路径就能得到答案。 PS:由于路径较短的是1到n直达,不经过其间任意一点,所以题目中要求的两种交通工具不能到达同一点(除1和n)的条件其实不用考虑。原创 2017-02-18 19:57:21 · 284 阅读 · 0 评论 -
POJ 3255 Roadblocks
次短路径原创 2017-03-02 18:26:10 · 159 阅读 · 0 评论 -
POJ 3169 Layout
原题链接思路: 转化为有负边的求最短路径问题,用Bellman-Ford算法 将每头牛当作一个顶点,互相亲近的牛由小编号指向大编号的边权值为正,互相厌恶的牛由大编号指向小编号的边权值为负 由i+1号牛指向i号牛的边权值为0 求此图中的最短路径 PS:从起点到j点沿箭头方向的路径上的权值和是第一头牛与j牛的最大距离,因此在所有由起点到j点的路径中,必须选取最小的一个,才能保证所有的路径都不原创 2017-03-02 18:48:41 · 172 阅读 · 0 评论 -
POJ 2139 Six Degrees of Cowvin Bacon
原题链接思路:floyd,任意两点最短距离。AC代码:#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> #include <cmath> #include <vector> #include <queue> using namespace std;//思路:原创 2017-03-17 19:20:40 · 155 阅读 · 0 评论