The gold miners 程序的编写

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问