Sample Input
2
0 0 0 1
0 1 1 0
Sample Output
1.00
1.41
代码实现:
// 求两点之间的距离,注意输出的格式即可
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
int main() {
double x1, x2, y1, y2, a, b, c, d, t;
double result;
cin >> t;
while (t--) {
cin >> x1 >> y1 >> x2 >> y2;
result = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
cout.setf(ios::fixed);
cout.precision(2);
cout << result << endl;
}
return 0;
}