我下载了错误示例,但是我的输出和题解的一样为啥错了呀

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

W_Moorer @ 2020-09-01 19:35:01

#include <stdio.h>
#include <math.h>

int main()
{
    double x[3],y[3],dis[3],p=0.0;
    scanf("%lf %lf %lf %lf %lf %lf",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);
    dis[0]=sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]));
    dis[1]=sqrt((x[3]-x[1])*(x[3]-x[1])+(y[3]-y[1])*(y[3]-y[1]));
    dis[2]=sqrt((x[2]-x[3])*(x[2]-x[3])+(y[2]-y[3])*(y[2]-y[3]));
    p=dis[0]+dis[1]+dis[2];
    printf("%.2lf\n",p);
    return 0;
}

by CE_WA_TLE @ 2020-09-01 20:04:30

x[3]


by W_Moorer @ 2020-09-02 13:08:47

@CE_WA_TLE thx,是我憨批了


|