http://acm.hdu.edu.cn/showproblem.php?pid=2547
//水题
#include <iostream>
#include <cmath>
using namespace std;
double func(double x, double y, double m, double n)
{
return (sqrt(x*x + y*y + m*m + n*n - 2*m*x - 2*n*y));
}
int main()
{
int t;
double a, b, c, d;
cin >> t;
while (t--) {
cin >> a >> b >> c >> d;
printf("%.1lf\n", func((a+c)/2,(b+d)/2, a, b)+func((a+c)/2,(b+d)/2, c, d) );
}
return 0;
}
阅读全文