#P5143. 攀爬者
攀爬者
Description
He marked points on a topographic map, where each point has coordinates . Among all points, the height values are pairwise distinct. HKE plans to climb from the lowest point to the highest point, and his climbing satisfies the following conditions:
(1) He visits every point he marked.
(2) Starting from the second point, the height of each visited point is higher than that of the previous point.
(3) HKE can fly. The distance he travels from a point to is the Euclidean distance between the two points, i.e., .
Now, HKE wants you to compute the total distance of his climb.
Input Format
The first line contains an integer indicating the number of points on the map.
Each of the next lines contains three integers , representing the coordinates of the -th point.
Output Format
Output a real number representing the total distance HKE needs to climb (rounded to three decimal places).
5
2 2 2
1 1 1
4 4 4
3 3 3
5 5 5
6.928
Hint
For 100% of the testdata, , and the answer is within the range of a double.
Translated by ChatGPT 5
京公网安备 11011102002149号