求达捞带(0分)

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

NachoDoritosLOL @ 2024-10-07 15:48:02

#include<bits/stdc++.h>
using namespace std;
double dist(int x1,int y1,int x2,int y2){
    return sqrt(pow(x2-x1,2)+pow(y2-y1,2));
}
int main(){
    int coor[2][3];
    double s=0;
    for(int i=0;i<3;i++){
        scanf("%d",&coor[i][0]);
        scanf("%d",&coor[i][1]);
    }
    s+=dist(coor[0][0],coor[1][0],coor[0][1],coor[1][1]);
    cout<<s<<endl;
    s+=dist(coor[0][1],coor[1][1],coor[0][2],coor[1][2]);
    cout<<s<<endl;
    s+=dist(coor[0][0],coor[1][0],coor[0][2],coor[1][2]);
    printf("%.2lf",s);
    return 0;
}

by Lots_of @ 2024-10-07 16:29:06

@NachoDoritosLOL 首先都写反了


|