shangyuang @ 2022-07-05 12:56:15
#include<bits/stdc++.h>
using namespace std;
double x1,y11,x2,y2,x3,y3;
double jl(int x1,int y11,int x2,int y2){
return sqrt((x1-x2)*(x1-x2)+(y11-y2)*(y11-y2));
}
int main(){
cin>>x1>>y11>>x2>>y2>>x3>>y3;
double s;
s+=jl(x1,y11,x2,y2);
s+=jl(x1,y11,x3,y3);
s+=jl(x2,y2,x3,y3);
printf("%.2lf",s);
return 0;
}
by Determined_ @ 2022-07-05 13:01:15
将函数中的 int 改为 double 就好了
by Determined_ @ 2022-07-05 13:04:48
如
double jl(double x1,double y11,double x2,double y2){
return sqrt((x1-x2)*(x1-x2)+(y11-y2)*(y11-y2));
}
by Determined_ @ 2022-07-05 13:06:37
@shangyuang
by shangyuang @ 2022-07-05 15:26:32
@Determined_ 哦~ Thanks