Timus Online Judge
About Online Judge
Frequently asked questions
Update your info
back to board
Discussion of Problem
. Pictura ex Machina
26 Jul 2009 22:56
I have Wa #8 many times, I don't know what's wrong!!! Can anybody check my code or give me a hint?
Re: WA #8
30 Jul 2009 19:45
There is my code, I still have WA #8:
using namespace std;
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)
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));
Re: WA #8
Oleg Strekalovsky [Vologda SPU]
31 Oct 2010 23:45
Try empty input.
If you use Java - don't use Scanner.
His hasNextDouble()/hasNextInt(), nextDouble()/nextInt() are too slow for large input.
Edited by author 31.10.2010 23:46
Timus Online Judge Team
. All rights reserved.