2422: 【普及-】【P5143】攀爬者

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:4 解决:4

题目描述

他在地形图上标记了 lns="http://www.w3.org/1998/Math/MathML"> 个点,每个点 lns="http://www.w3.org/1998/Math/MathML"> 都有一个坐标 lns="http://www.w3.org/1998/Math/MathML">(,,)。所有点对中,高度值 lns="http://www.w3.org/1998/Math/MathML"> 不会相等。HKE 准备从最低的点爬到最高的点,他的攀爬满足以下条件:

(1) 经过他标记的每一个点;

(2) 从第二个点开始,他经过的每一个点高度 lns="http://www.w3.org/1998/Math/MathML"> 都比上一个点高;

(3) HKE 会飞,他从一个点 lns="http://www.w3.org/1998/Math/MathML"> 爬到 lns="http://www.w3.org/1998/Math/MathML"> 的距离为两个点的欧几里得距离。即,lns="http://www.w3.org/1998/Math/MathML">()2+()2+()2

现在,HKE 希望你能求出他攀爬的总距离。

输入

第一行,一个整数 lns="http://www.w3.org/1998/Math/MathML"> 表示地图上的点数。

接下来 lns="http://www.w3.org/1998/Math/MathML"> 行,三个整数 lns="http://www.w3.org/1998/Math/MathML">,, 表示第 lns="http://www.w3.org/1998/Math/MathML"> 个点的坐标。

输出

一个实数,表示 HKE 需要攀爬的总距离(保留三位小数)

样例输入 复制

5
2 2 2
1 1 1
4 4 4
3 3 3
5 5 5

样例输出 复制

6.928

提示

对于100%的数据,lns="http://www.w3.org/1998/Math/MathML">150000,答案的范围在 double 范围内。