F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Jiajia's Robot

Time 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.


Fig. The collection of points from which the robot can localize itself.

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
264 280 147 360 162 335 320 334 203 165 288 227 149 295 153 344 0 0 0 0 0 0 0 0
 

Sample Output
Case 1: 26634.633 Case 2: 27436.383
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 14:51:58, Gzip enabled