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

建议使用的浏览器:

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

3868:The Triangle ransmitter

题目描述
The Kingdom of Silence is a beautiful country. There are N cities in the kingdom. There are several highways so that people can go from a city to another one. But there are so many cars in the kingdom that there are too many traffic congestions in the kingdom.

In order to solve the problem, Dr. Lin made a new invention named Triangle Transmitter. This transmitter is designed to travel among three cities and no matter how long the distance is, we can reach our destination in the three cities in 1 second.

Although the Triangle Transmitter is so excellent, it is so expensive that the king can only build one transmitter to test it. Because it is only for testing, we should make it as cheap as possible. If we build a Triangle Transmitter in three cities, the money we will pay is equal to the sum of the distance between every two cities in the three cities.

Now it is your job to choose three cities to build a Triangle Transmitter so that the king will spend least money. What's more, the king will give you the number of the cities N and the position of each city. The position of each city is described by two integers xi and yi, the distance between two cities is sqrt((xi - xj)^2 + (yi - yj)^2). And no two cities have the same position.
输入解释
The first line contains a single integer T, the number of test cases. And then followed T cases.

In the first line of each test case, there is one integer N (3<=N<=20000) indicates the number of the cities and the cities are numbered from 1 to N.
Then followed N lines, in each line there are two integers xi and yi (0<=xi,yi<=10^9), indicates the position of each city.
输出解释
The output should contain T lines. For each test case you should just output an real number with exactly three digits after a decimal point which is the least money that the king have to pay.
输入样例
1
4
0 0
0 1
1 0
5 5
输出样例
3.414
提示
In the sample we can choose the first three cities to build the transmitter.
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3868

最后修改于 2020-10-25T23:07:45+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)