ANGELA2002 @ 2021-02-21 09:38:00
#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,x3,y1,y2,y3,c=0;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
c+=dis(x1,y1,x2,y2)+dis(x1,y1,x3,y3)+dis(x3,y3,x2,y2);
cout<<c;
return 0;
}
by Reywmp @ 2021-02-21 09:46:54
最后用 printf("%.2lf\n",c);
形式保留2位小数。
by Reywmp @ 2021-02-21 09:48:11
%.(x)lf
表示 double
类型输出保留 x
位小数
by 一只小可爱吖 @ 2021-02-21 09:58:30
保留两位小数
by 一只小可爱吖 @ 2021-02-21 09:58:56
呃,您好像主页双帖诶
by ANGELA2002 @ 2021-02-21 10:02:33
@一只小可爱吖 ??为什么会上主页
by ANGELA2002 @ 2021-02-21 10:03:05
@岚风吹 谢谢
by 一只小可爱吖 @ 2021-02-21 10:06:21
@ANGELA2002 啥啊,所有帖子都会上主页啊