codeprocessing @ 2023-11-11 15:17:38
#include<bits/stdc++.h>
using namespace std;
struct tri{
double x1;
double x2;
}t[5];
int main(){
cin>>t[1].x1;
cin>>t[1].x2;
cin>>t[2].x1;
cin>>t[2].x2;
cin>>t[3].x1;
cin>>t[3].x2;
double lenth=0,lenth2=0,lenth3=0;
lenth=sqrt(pow(t[1].x2-t[1].x1,2*1.0)+pow(t[2].x2-t[2].x1,2*1.0));
lenth2+=sqrt(pow(t[1].x2-t[1].x1,2*1.0)+pow(t[3].x2-t[3].x1,2*1.0));
lenth3+=sqrt(pow(t[2].x2-t[2].x1,2*1.0)+pow(t[3].x2-t[3].x1,2*1.0));
printf("%.2lf",lenth+lenth2+lenth3);
return 0;
}
爆0了
by a1co0av5ce5az1cz0ap_ @ 2023-11-11 15:25:31
我也不会
by _kpsum @ 2023-11-11 15:27:38
我也不会!
by M3te0rDream @ 2023-11-11 15:28:23
不用这么麻烦啊
#include<bits/stdc++.h>
using namespace std;
double X1,Y1,X2,Y2,X3,Y3,ans=0;
double f(double X1,double Y1,double X2,double Y2){
return sqrt((X2-X1)*(X2-X1)+(Y2-Y1)*(Y2-Y1));
}
signed main(){
cin>>X1>>Y1>>X2>>Y2>>X3>>Y3;
ans=f(X1,Y1,X2,Y2)+f(X1,Y1,X3,Y3)+f(X2,Y2,X3,Y3);
cout<<fixed<<setprecision(2)<<ans;
return 0;
}
by D_G_O @ 2023-11-11 15:29:21
我也不会!!
by HgSO4_QwQ @ 2023-11-11 15:30:31
我也不会!!!
by Halberd_Cease @ 2023-11-11 15:34:09
我也不会!!!!
by Forgotten_Dream @ 2023-11-11 15:36:11
距离公式写错了……
by Forgotten_Dream @ 2023-11-11 15:38:10
@Forgotten_Dream 应该是
lenth=sqrt(pow(t[1].x2-t[2].x2,2*1.0)+pow(t[1].x1-t[2].x1,2*1.0))
吧
by HJY2022 @ 2023-11-11 15:44:30
我也不会!!!
by codeprocessing @ 2023-11-11 16:10:34
@xXMeteorDreamXx 感谢!