Quantcast
Channel: C++博客-所有随笔
Viewing all articles
Browse latest Browse all 7881

UVa 117 The Postal Worker Rings Once

$
0
0

总结

图论问题,经过简单的分析,其实是一个单源最短路径问题。

分析

There will be at most two intersections with odd degree
说明存在欧拉通路(Eulerian path)。有两种情况:
  1. 所有交点的度(Degree)都为偶数。

    那么就存在欧拉回路(Eulerian circuit)。最短路程就是所有边长之和。
  2. 有且只有两个交点有奇数度(Degree

    那么这两个交点就是欧拉通路的起点和终点。接下来只要找到这两点之间的最短路径,最终最短路程就是所有边长之和加上这两点的最短路径长度。


happyac 2013-06-13 09:26 发表评论

Viewing all articles
Browse latest Browse all 7881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>