Challenge of Bravery
Time Limit: 10 Seconds Memory Limit: 32768 KB
Background
I am at a gate, there're some words on the gate: "Brave boy! You have passed all the dangers, and I've waited for you for years! Finally, you came."
"This is the gate to your heart! Before going on, I still want to have a test on you, first is your bravery."
The gate disappeared; left some stones floating in the sky...
And a monster came...
Problem
There're N (N <= 50) stones. I can step on it, and after I stepped on it, it will disappear. Of course, the monster is running after me! I must touch on each stone exactly once, and step on any other stone, and the monster will fall into the dark. I want to finish it as quickly as possible. Time I needed is the distance between the stones.
I'm at stone 1 at first.
Input
This problem contains multiple test cases.
Each test case begins with an integer N, then followed by N lines, each lines contains 3 numbers: x, y, z, representing the coordinate of the stones. I can step on any stone at last except 1.
Output
For each test case, output the minimum distance, having 1 digit after radix point.
Sample Input
2 1 1 1 2 2 2
Sample Output
1.7Submit
Source: JIANG, Yanyan's Contest #2