amen123111 @ 2023-11-16 14:34:52
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int x1, x2, x3, y1, y2, y3;
scanf("%d %d", &x1, &y1);
scanf("%d %d", &x2, &y2);
scanf("%d %d", &x3, &y3);
double dis1, dis2, dis3;
dis1 = sqrt(abs(x1 - x2) * abs(x1 - x2) + abs(y1 - y2) * abs(y1 - y2));
dis2 = sqrt(abs(x3 - x2) * abs(x3 - x2) + abs(y3 - y2) * abs(y3 - y2));
dis3 = sqrt(abs(x1 - x3) * abs(x1 - x3) + abs(y1 - y3) * abs(y1 - y3));
double sum = dis1 + dis2 + dis3;
printf("%.2lf",sum);
return 0;
}
by amen123111 @ 2023-11-16 20:42:46
@amen123111 怎么搞啊,看不出来什么问题
by GaIaxy @ 2023-11-18 22:58:10
数据保证,坐标均为实数且绝对值不超过 100,小数点后最多仅有 3 位。
把int
改成double
by whr001 @ 2024-02-16 12:07:50
@amen123111 把int改成double 把%d都改成%lf @amen123111