Lilindong @ 2024-09-17 14:26:57
#include<stdio.h>
#include<math.h>
int x1,x2,y1,y2,z1,z2;
double e,sum;
double lon(int a, int b ,int c ,int d)
{
return sqrt((a-c)*(a-c)+(b-d)*(b-d));
}
int main()
{
scanf("%d%d%d%d%d%d",&x1,&x2,&y1,&y2,&z1,&z2);
sum=lon(x1,x2,y1,y2)+lon(x1,x2,z1,z2)+lon(y1,y2,z1,z2);
printf("%.2lf",sum);
return 0;
}
by Lilindong @ 2024-09-17 14:28:48
这是测试数据 in 23.234 12.123 -99.99 99.99 -1 -100 2 out 489.20
by yangxikun @ 2024-09-17 14:34:38
@Lilindong 你函数传参数时不能是int
by Lilindong @ 2024-09-19 21:25:57
@yangxikun 为什么呀,那应该用double是吗
by yangxikun @ 2024-09-20 15:54:05
@Lilindong 是的