F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

The Triangle ransmitter

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 769    Accepted Submission(s): 334


Problem Description
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.
 

Input
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.
 

Output
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.
 

Sample Input
1 4 0 0 0 1 1 0 5 5
 

Sample Output
3.414
 

Hint
In the sample we can choose the first three cities to build the transmitter.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 21:23:17, Gzip enabled