AcWing 3571. 点的距离
原题链接
简单
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int N = 1e6+10;
int t,n,m,k,l,r,op,x,y;
int a,b,c,d;
int f[N];
bool flag;
struct CPoint{
int _x,_y;
CPoint(int x,int y):_x(x),_y(y){}
double cacl(const CPoint&c)const{
return sqrt(pow(_x-c._x,2)+pow(_y-c._y,2));
}
};
void solve(){
cin>>t;
while(cin>>a>>b>>c>>d){
CPoint c1(a,b),c2(c,d);
cout<<fixed<<setprecision(2)<<c1.cacl(c2)<<"\n";
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
solve();
return 0;
}