"听取WA声一片"0分求助!!!
  • 板块P5143 攀爬者
  • 楼主dongrq_cs
  • 当前回复7
  • 已保存回复7
  • 发布时间2023/4/3 18:30
  • 上次更新2023/10/23 19:32:25
查看原帖
"听取WA声一片"0分求助!!!
644394
dongrq_cs楼主2023/4/3 18:30
#include <bits/stdc++.h>
using namespace std;
int n;
double ans;
struct mate{
	int x,y,z;
}a[50100];
bool cmp(mate x,mate y){
	return x.z < y.z;
}
int main(){
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i].x >> a[i].y >> a[i].z;
	}
	sort(a + 1,a + n + 1,cmp);
	for(int i = 1;i < n;i++){
		int q = (a[i].x - a[i + 1].x);
		int b = (a[i].x - a[i + 1].x);
		int c = (a[i].y - a[i + 1].y);
		int d = (a[i].y - a[i + 1].y);
		int e = (a[i].z - a[i + 1].z);
		int f = (a[i].z - a[i + 1].z);
		int w = sqrt(q + b + c + d + e + f);
		ans += q;
	}
	cout << ans << fixed << setprecision(3);
	return 0;
}
2023/4/3 18:30
加载中...