Re: WA #8
There is my code, I still have WA #8:
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main()
{
double x1, x2, y1, y2, Right = -1e9, Left = 1e9, Up = -1e9, Down = 1e9;
double x3, y3, x0, y0, n, m;
int N = 0;
while (cin >> x1 >> y1 >> x2 >> y2)
{
N ++;
x0 = (x1 + x2) / 2.0;
y0 = (y1 + y2) / 2.0;
n = x1 - x0;
m = y1 - y0;
x3 = m + x0;
y3 = -n + y0;
Left = min(Left, min(x1, min(x2, x3)));
Right = max(Right, max(x1, max(x2, x3)));
Up = max(Up, max(y1, max(y2, y3)));
Down = min(Down, min(y1, min(y2, y3)));
}
if (N == 0) printf("%0.4f %0.4f", 0, 0);
else printf("%0.4f %0.4f", fabs(Right - Left), fabs(Up - Down));
return 0;
}