HarryPotterJames @ 2020-08-30 13:11:32
#include<bits/stdc++.h>
using namespace std;
int main()
{
double x1,x2,y1,y2,z1,z2;
cin>>x1>>x2>>y1>>y2>>z1>>z2;
double a1=sqrt(pow(x1-x2,2)*pow(y1-y2,2));
double b1=sqrt(pow(x1-x2,2)*pow(z1-z2,2));
double c1=sqrt(pow(y1-y2,2)*pow(z1-z2,2));
double sum=a1+b1+c1;
cout<<fixed<<setprecision(2)<<sum;
return 0;
}
by HarryPotterJames @ 2020-09-01 21:24:18
不好意思,刚看到。 谢谢大佬们! @⚡小林子⚡ @limaopipi2022 @Sky_Dreamer
by HarryPotterJames @ 2020-09-02 12:44:26
#include<bits/stdc++.h>
using namespace std;
double dis(double x1,double x2,double y1,double y2)
{
return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
int main()
{
double x1,x2,x3,y1,y2,y3;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
double a1=dis(x1,y1,x2,y2);
double b1=dis(x1,y1,x3,y3);
double c1=dis(x2,y2,x3,y3);
printf("%.2lf",a1+b1+c1);
return 0;
}
结果怎么还是全WA? @⚡小林子⚡ 请教一下,谢谢!
by ⚡小林子⚡ @ 2020-09-02 12:51:02
@HarryPotterJames 你是 x1,x2,y1,x2
这么传的,改成 x1,y1,x2,y2
就能过