中国邮路问题c语言代码

时间:2012-12-23 02:05:20
【文件属性】:

文件名称:中国邮路问题c语言代码

文件大小:1KB

文件格式:TXT

更新时间:2012-12-23 02:05:20

最短遍历

实现n<15的最短遍历 Gord is training for a marathon. Behind his house is a park with a large network of jogging trails connecting water stations. Gord wants to find the shortest jogging route that travels along every trail at least once. Input Input consists of several test cases. The first line of input for each case contains two positive integers: n <= 15, the number of water stations, and m < 1000, the number of trails. For each trail, there is one subsequent line of input containing three positive integers: the first two, between 1 and n, indicating the water stations at the end points of the trail; the third indicates the length of the trail, in cubits. There may be more than one trail between any two stations; each different trail is given only once in the input; each trail can be travelled in either direction. It is possible to reach any trail from any other trail by visiting a sequence of water stations connected by trails. Gord's route may start at any water station, and must end at the same station. A single line containing 0 follows the last test case. Output


网友评论

  • 学习一下 感谢分享
  • 还行吧 不怎么详细
  • c语言的,还能用
  • 代码都没有注释~~不是很好的习惯~~而且功能过于简单
  • 怎么介绍是英文的?不过代码还可以吧,就是功能不全