最后一个点过不了

P5735 【深基7.例1】距离函数

Reeel @ 2021-11-27 18:51:13

#include<stdio.h>
#include<math.h>
double distant(int x1,int x2,int y1,int y2)
{
    double dis;
    dis=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
    return dis;
}
int main()
{
    int x1,x2,x3,y1,y2,y3;
    double dis1,dis2,dis3,C;
    scanf("%d %d\n %d %d\n %d %d",&x1,&y1,&x2,&y2,&x3,&y3);
    dis1=distant(x1,x2,y1,y2);
    dis2=distant(x2,x3,y2,y3);
    dis3=distant(x1,x3,y1,y3);
    C=dis1+dis2+dis3;
    printf("%.2f",C);
}

最后一个点过不了啊,大佬们多多指教


by _lfxxx_ @ 2021-11-27 18:54:27

坐标值是实数


by underline__jian @ 2021-12-19 16:25:05

全部都是double类型的


|