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

建议使用的浏览器:

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

2631:Roads in the North

题目描述
Building and maintaining roads among communities in the far North is an expensive business. With this in mind, the roads are build such that there is only one route from a village to a village that does not pass through some other village twice.
Given is an area in the far North comprising a number of villages and roads among them such that any village can be reached by road from any other village. Your job is to find the road distance between the two most remote villages in the area.

The area has up to 10,000 villages connected by road segments. The villages are numbered from 1.
输入解释
Input to the problem is a sequence of lines, each containing three positive integers: the number of a village, the number of a different village, and the length of the road segment connecting the villages in kilometers. All road segments are two-way.
输出解释
You are to output a single integer: the road distance between the two most remote villages in the area.
输入样例
5 1 6
1 4 5
6 3 9
2 6 8
6 1 7
输出样例
22

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

源链接: POJ-2631

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

共提交 0

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