求助,只有第4个点AC

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

dotCJ @ 2020-06-14 22:26:41

#include <bits/stdc++.h>
using namespace std;
double dis(double x1,double y1,double x2,double y2){
    return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
int main(){
    double x1,x2,y1,y2,x3,y3;
    cin>>x1>>x2>>y1>>y2>>x3>>y3;
    printf("%.2lf",dis(x1,y1,x2,y2)+dis(x2,y2,x3,y3)+dis(x1,y1,x3,y3));
    return 0;
}

by cvyl30 @ 2020-06-14 22:32:26

读入顺序是 x_1,y_1,x_2,y_2,x_3,y_3((


by Smile_Cindy @ 2020-06-15 07:56:00

@清明放不下的Y 请仔细读题。


by dotCJ @ 2020-07-10 16:01:35

@Alpha 十分感谢


by dotCJ @ 2020-07-10 16:01:43

@553032651yyj 十分感谢


|