wmbwww @ 2023-09-01 19:28:22
#include <bits/stdc++.h>
using namespace std;
struct zc {
int x;
int y;
}a[4];
int cd(zc a, zc b) {
double a1 = pow((b.x - a.x), 2.0);
double a2 = pow((b.y - a.y), 2.0);
double zc = pow((a1 + a2), 1 / 2);
return zc;
}
int main() {
for (int i = 1; i <= 3; i++) {
cin >> a[i].x >> a[i].y;
}
double zzc = cd(a[1], a[2]) + cd(a[1], a[3]) + cd(a[2], a[3]);
printf("%0.2lf", zzc);
return 0;
}
按公式写的
by Iniaugoty @ 2023-09-01 19:49:58
哦,坐标值是实数,把所有变量都改成 double
类型吧
by wmbwww @ 2023-09-01 20:15:21
嗯