HumbleTY @ 2023-06-06 11:47:15
在vs2022编译器上进行了测试,过了 但是过不了洛谷的测评,求助
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
typedef double ele;
struct point {
ele x; ele y;
};
int dis(struct point a, struct point b) {
return sqrt( (a.x - b.x)* (a.x - b.x) + (a.y - b.y)*(a.y - b.y) );
}
int main() {
struct point inp[3];
int r;
for (r = 0; r < 3; r++) {
scanf("%lf %lf", &inp[r].x, &inp[r].y);
}
ele ans = 0;
for (r = 0; r < 2; r++) {
ans += dis(inp[r], inp[r + 1]);
}
ans += dis(inp[2], inp[0]);
printf("%.2lf", ans);
}
by 童年的小翼龙 @ 2023-06-06 12:04:47
dis
函数返回值不应当是 int
类型