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

建议使用的浏览器:

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

2820:TN's Kingdom II - Construction

题目描述
It was the first anniversary of TN's coronation. After one year's reconstruction, towns and cities were gradually rebuilt. There emerged a call for a complete traffic system. Among all choices to solve the problem, TN considered the construction of an expressway system the best one. He followed his old way in planning - to build the fewest number of expressways that would connect all the cities.

Though it was a similar case to what had previously been done, differences existed. The most significant one was that building expressways was costly. TN wanted to minimize the cost to achieve the goal. It was known that the cost of building an expressway between two cities was proportional to the distance between the cities. What was more, the expressways were straight and no two expressways could cross each other due to technical limitations. Now TN was holding a map of his kingdom, fallen deep in thinking. How should he make the plan?

输入解释
The input consists of a single test case. The first line of input contains a positive integer N not exceeding 105 which is the number of cities in the kingdom. Then N lines follow. Each line contains a pair of non-negative integers within 50,000, giving in that order the x- and y-coordinates of a city in the Cartesian coordinate system. The distance between two cities was measured in the L2-metric, which means for two cities located at (x1, y1) and (x2, y2), the distance between them was


输出解释
Your solution should output a single number rounded to four decimal places which is the minimum cost of building the expressways under the assumption that building an expressway covering one unit of distance required exactly one unit of cost.
输入样例
2
0 0
1 1
输出样例
1.4142
提示
It is recommended that your solution uses standard C I/O interface to achieve better efficiency and avoid unpredictable behaviours.
来自北京大学POJ的附加信息
Case time limit(单组数据时间限制) 6000MS

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

源链接: POJ-2820

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

共提交 0

通过率 --%
时间上限 内存上限
10000 131072