c全wa求助

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

sanammm @ 2022-10-26 23:23:53

#include<stdio.h>
#include<math.h>
int dis(int x1,int y1,int x2,int y2)
{
    float s;
    s=sqrt(1.0*abs(x2-x1)*abs(x2-x1)+1.0*abs(y2-y1)*abs(y2-y1));
    return s;
}
int main()
{
    int x1,y1,x2,y2,x3,y3;
    scanf("%d %d",&x1,&y1);
    scanf("%d %d",&x2,&y2);
    scanf("%d %d",&x3,&y3);
    float s;
    s=dis(x1,y1,x2,y2)+dis(x3,y3,x2,y2)+dis(x3,y3,x1,y1);
    printf("%.2f",s);
    return 0;
}

明明样例都能输出来,,


by BIG_CUTE_BUG @ 2022-10-26 23:27:49

数据保证,坐标均为实数


by sanammm @ 2022-10-26 23:34:18

@B1G_CUTE_BUG 哦哦哦


|