P5143 攀爬者 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
知识点:
import math
n = int(input())
data = []
for i in range(n):
l = list(map(int,input().split()))
data.append(l)
data.sort(key = lambda x:x[2])
sum = 0
for i in range(1,n):
sum += math.sqrt((data[i][0]-data[i-1][0])**2 + (data[i][1]-data[i-1][1])**2 + (data[i][2]-data[i-1][2])**2)
print('%.3f' %sum)