当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2404:Jogging Trails

题目描述
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 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.
输出解释
For each case, there should be one line of output giving the length of Gord's jogging route.
输入样例
4 5
1 2 3
2 3 4
3 4 5
1 4 10
1 3 12
0
输出样例
41

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2404

最后修改于 2020-10-29T06:31:41+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536