ptsxlhs @ 2024-04-10 09:32:22
#include<bits/stdc++.h>
using namespace std;
double dis(int x1,int y1,int x2,int y2){
return sqrt(abs((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)));
}
int main(){
double x1,y1,x2,y2,x3,y3;
cin>> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
cout<< fixed << setprecision(2) << dis(x1,y1,x2,y2)+dis(x2,y2,x3,y3)+dis(x3,y3,x1,y1);
return 0;
}
by L_zaa_L @ 2024-04-10 10:28:44
@ptsxlhs 函数调用的变量应该用double。
by ptsxlhs @ 2024-04-10 21:11:04
@zaa 谢谢