_mei_tou_nao_ @ 2024-08-19 13:28:59
using namespace std;
double a, b, c, d, x1, y1, x2, y2, x3, y3;
int main() {
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
a = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
b = sqrt(pow(x3 - x1, 2) + pow(y3 - y1, 2));
c = sqrt(pow(x3 - x2, 2) + pow(y3 - y2, 2));
d = a + b + c;
cout << fixed << setprecision(2) << d;
return 0;
}
by zhizhenhuyuzhe @ 2024-08-19 14:04:19
#include<bits/stdc++.h>
using namespace std;
struct k{
double q,w;//x1,y1;
};
struct u{
double e,r;//x2,y2;
};
struct n{
double t,u;//x3,y3;
};
k a;
u b;
n c;
int main(){
cin>>a.q>>a.w>>b.e>>b.r>>c.t>>c.u;
double f,g,h;
f=sqrt((b.e-a.q)*(b.e-a.q)+(b.r-a.w)*(b.r-a.w));
g=sqrt((c.t-a.q)*(c.t-a.q)+(c.u-a.w)*(c.u-a.w));
h=sqrt((c.t-b.e)*(c.t-b.e)+(c.u-b.r)*(c.u-b.r));
cout<<fixed<<setprecision(2)<<(f+g+h);
return 0;
}
by xuxiyuan1112 @ 2024-08-19 14:13:28
把y1的1去掉
by medal_dreams @ 2024-08-19 15:56:27
@_mei_tounao 有可能是因为
by wangmuze @ 2024-08-23 09:54:23
万能头有y1变量,用y1就会报错