我下载了错误示例,但是我的输出和题解的一样为啥错了呀
查看原帖
我下载了错误示例,但是我的输出和题解的一样为啥错了呀
380322
W_Moorer楼主2020/9/1 19:35
#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;
}
2020/9/1 19:35
加载中...