Submit | All submissions | Best solutions | Back to list |
RECTAREA - Homogeneous area |
Wersja polska | English version |
Given two rectangles You are to calculate the area they occupy.
Input
There is unknown number of tests. Each test consist of eight integers xA1 yA1 xA2 yA2 xB1 yB1 xB2 yB2 (|all|<=106).
Input ends when all numbers equal 0.
Output
For each test You should print the area these two rectangles occupy.
Example
Input: 6 4 9 9 5 5 10 10 10 5 5 10 9 9 6 4 0 0 0 0 0 0 0 0 Output: 28 28
Illustration to the 1st test
Special thanks to Rafał Spręga for the concept of this task.
Added by: | Piotr Kąkol |
Date: | 2011-01-22 |
Time limit: | 1.794s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: SCM qobi |
Resource: | Yet another SHORTEN task |
hide comments
2011-06-26 23:28:22 Piotr KÄ…kol
@Jander - sorry, but why it's not obvious? I wrote that |all| are positive? || means absolute value. Did You have any doubts? |
|
2011-06-26 16:11:22 Jander
Ah, ok - it's not clear from the info that the input can be -ve. Okay, now to work on the fix :-) Edit: I've seen the flaw. Now to work out a neat way around it. Last edit: 2011-06-26 16:55:50 |
|
2011-06-26 15:47:33 Piotr KÄ…kol
@JAnder - You print wrong answers for negative numbers. Example: In: -662332 -803342 -267556 241124 999128 497146 -418841 334500 Out: 642957095590 |
|
2011-06-26 15:33:04 Jander
@Piotr - Can you tell me why 5299215 gets WA ? |