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

The gold miners

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 228    Accepted Submission(s): 62


Problem Description
There are some funny mini games on the internet. Sailormoon girls usually play these games in them spare time. They always play a mini game named THE GOLD MINNERS. Now they give you a problem about this game. Could you solve it? Now let¡¯s look at the following picture.
  

We set the position of the minner as the origin of coordinate.There are many objects in this game,not only gold. They also have diamonds,stones,and other unknown things.All the objects can be treated as polygon. Every two polygons can not intersect. In this problem,we will give you some data about the angle in order. When the hook with certain angle sinking, it will always catch nearest object, and get the corresponding money. There will be nothing in the position of this object later. If there have no objects,the hook will return back to the origin of coordinate. How much money does the minner have at last?Do you know?
 

Input
There are multiple test cases.
Each case begins with a positive integer N (0 <= N <= 30) , it means there are N objects.
The following N * 2 lines describe the informatin about objects. Each object starts with a positive integer V (3 <= V <= 15), it means this object can be treated as a polygon with V vertex. Followed by a positive integer W which is the value of this object.
The next line contains V * 2 decimal number. X1,Y1,X2,Y2¡­¡­Xv,Yv. You can suppose all coordinate data are in the double range.Vertex coordinates clockwise.
Then followed by a positive integer M (M <= 100) which is number of the minner cast hook.
The following M lines contains M positive integer.The Xth integer means the angle with which the minner cast hook the Xth.(0 < angle < 180)
 

Output
Calculate and print the value of the minner earn at last for each test case.
 

Sample Input
4 4 158 0.0 -1.0 2.0 -1.0 0.0 -3.0 -1.0 -2.0 4 37 4.0 -1.0 4.0 -2.0 3.0 -2.0 3.0 -1.0 6 360 2.0 -3.0 3.0 -3.0 2.0 -5.0 1.0 -5.0 1.0 -4.0 2.0 -4.0 5 223 -2.0 -4.0 -2.0 -5.0 -3.0 -6.0 -4.0 -5.0 -4.0 -4.0 3 45 16 127 5 4 10 -3.0 0.0 -2.0 -1.0 -3.0 -1.0 -4.0 0.0 4 208 -2.0 0.0 0.0 -1.0 3.0 -1.0 0.0 -3.0 6 660 3.0 -2.0 4.0 -2.0 5.0 -3.0 6.0 -3.0 6.0 -6.0 3.0 -6.0 4 25 -1.0 -4.0 2.0 -4.0 2.0 -6.0 -1.0 -6.0 3 18 0.0 -7.0 1.0 -8.0 -1.0 -8.0 3 34 64 90
 

Sample Output
418 251
 

Author
B.A.C
 

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-05-12 04:28:08, Gzip enabled