标签:class blog div code com size http string tar margin har
#include <stdio.h>
#include <string.h>
#include <math.h>
int t;
struct Point {
double x, y;
Point() {}
Point(double _x, double _y) {
x = _x; y = _y;
}
void scan() {
scanf("%lf%lf", &x, &y);
}
} a, b, c, d;
double dis(Point a, Point b) {
double x = a.x - b.x;
double y = a.y - b.y;
return sqrt(x * x + y * y);
}
int main() {
scanf("%d", &t);
while (t--) {
a.scan();
b.scan();
c = Point(-b.x, b.y);
d = Point(a.x, -a.y);
printf("%.3lf\n", dis(a, b) + dis(c, d));
}
return 0;
}UVA 11314 - Hardly Hard(数论),码迷,mamicode.com
标签:class blog div code com size http string tar margin har
原文地址:http://blog.csdn.net/accelerator_/article/details/24579829