|
||||||||||
Jiajia's RobotTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 640 Accepted Submission(s): 196 Problem Description Jiajia wants to do some experiments on his two-eyed robot. Each eye of the robot shoots a very thin laser beam from it, which goes infinitely (i.e. a mathematical "ray"). Restricted by the internal structure, the two laser beams from the eyes must always form a right angle (i.e. two rays must be perpendicular to each other). To help the robot localize itself, Jiajia placed two linear-shaped special materials called MA and MB. If one of the rays intersects with MA, while the other ray intersects with MB, the robot is able to gather enough spatial information for the localization. The weird shape in the picture above is the collection of points from which the robot can localize itself. MA and MB are drawn as two line segments. Though the task seems a little bit difficult, can you tell me the total area of these points? Input There will be at most 50 test cases. Each case contains a single line of 8 positive integers x1, y1, x2, y2, x3, y3, x4, y4 not greater than 500, where (x1,y1) and (x2,y2) are two endpoints of MA, (x3,y3) and (x4,y4) are two endpoints of MB. Note that MA and MB can have at most one common point. Neither MA nor MB will be degenerated to a point. The last test case is followed by 8 zeros, which should not be processed. Output For each test case, print the total area of "self-localizable point", to 3 digits after the decimal point. Print a blank line after the output of each test case. Sample Input
Sample Output
Source | ||||||||||
|