Nornir0127 @ 2022-09-12 18:12:49
#include<bits/stdc++.h>
using namespace std;
int i,a[4],b[4],u;
double sum=0,r;
double dis(double a1,double a2,double b1,double b2){
r=sqrt((a1-a2)*(a1-a2)+(b1-b2)*(b1-b2));//勾股定理;
return r;
}
int main(){
for(i=1;i<=3;i++){
cin>>a[i];
cin>>b[i];
}
//cout<<a[3]<<' '<<b[3]<<endl;
for(i=1;i<=3;i++){
if(i==3){
sum+=dis(a[i],b[i],a[1],b[1]);//一和三拉线
break;
}
sum+=dis(a[i],b[i],a[i+1],b[i+1]);//一二、二三拉线
}
printf("%.2f",sum);//输出两位小数
return 0;
}