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

Polygons

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 629    Accepted Submission(s): 240


Problem Description
Given two convex polygons, they may or may not overlap. If they do overlap, they will do so to differing degrees and in different ways. Write a program that will read in the coordinates of the corners of two convex polygons and calculate the `exclusive or' of the two areas, that is the area that is bounded by exactly one of the polygons. The desired area is shaded in the following diagram:


 

Input
Input will consist of pairs of lines each containing the number of vertices of the polygon, followed by that many pairs of integers representing the x,y coordinates of the corners in a clockwise direction. All the coordinates will be positive integers less than 100. For each pair of polygons (pair of lines in the data file), your program should print out the desired area correct to two decimal places. The input will end with a line containing a zero (0).
 

Output
Output will consist of a single line containing the desired area written as a succession of eight (8) digit fields with two (2) digits after the decimal point. There will not be enough cases to need more than one line.
 

Sample Input
3[bk][bk]5[bk]5[bk][bk]8[bk]1[bk][bk]2[bk]3 3[bk][bk]5[bk]5[bk][bk]8[bk]1[bk][bk]2[bk]3 4[bk][bk]1[bk]2[bk][bk]1[bk]4[bk][bk]5[bk]4[bk][bk]5[bk]2 6[bk][bk]6[bk]3[bk][bk]8[bk]2[bk][bk]8[bk]1[bk][bk]4[bk]1[bk][bk]4[bk]2[bk][bk]5[bk]3 0
 

Sample Output
[bk][bk][bk][bk]0.00[bk][bk][bk]13.50
 

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-04-24 18:28:43, Gzip enabled