Liuqs @ 2022-03-08 10:16:48
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
double sq(double x)
{
return x*x;
}
double dis(double x1,double y1,double x2,double y2)
{return sqrt(sq(x2-x1)+sq(y2-y1));}
int main(){
double c=0,x1,y1,x2,y2,x3,y3;
cin>>x1>>y1>>x2>>y2>>y3>>y3;
c+=dis(x1,y1,x2,y2);
c+=dis(x2,y2,x3,y3);
c+=dis(x1,y1,x3,y3);
printf("%.2f",c);
return 0;
}
by JDS070115 @ 2022-03-08 10:30:19
cin >> x1 >> y1 >> x2 >> y2 >> y3 >> y3
y3
读入了 两遍 。
改一下就可以了。(码风令人感动)
by exercise @ 2022-06-12 19:18:34
#include<bits/stdc++.h>
using namespace std;
double BBQ(double x,double y)
{
if (x>y)
{
return (x-y)*(x-y);
}
else
{
return (y-x)*(y-x);
}
}
double a,b,c,d,e,f,g,k,l,o;
int main()
{
cin>>a>>b>>c>>d>>e>>f;
k=BBQ(a,c)+BBQ(b,d);
g=sqrt(k);
k=BBQ(f,d)+BBQ(c,e);
l=sqrt(k);
k=BBQ(a,e)+BBQ(b,f);
o=sqrt(k);
cout<<fixed<<setprecision(2)<<g+l+o;
}
我不李姐你的代码OUO..............