原题链接
数学公式
两点之间的距离=
知道了公式,就可以写下代码辣
code
知道你们最喜欢
#include<bits/stdc++.h>
#define int double
using namespace std;
int func(int x1,int y1,int x2,int y2){
return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));//公式
}
int ans;
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int x1,y1,x2,y2,x3,y3;
cin>>x1>>y1>>x2>>y2>>x3>>y3;
ans+=func(x1,y1,x2,y2);
ans+=func(x1,y1,x3,y3);
ans+=func(x2,y2,x3,y3);
printf("%.2lf",ans);//保留两位小数
return 0;
}4年级小学生蒟蒻第一次写题解,管理员大大球过