Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
Statistical Charts
Submit Problem
Online Status
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Shadow Area
Time Limit: 1000MSMemory Limit: 65536K
Total Submissions: 522Accepted: 81


The local government has just passed a motion that more trees should be planted in down town. But as it is down town, there are many high buildings and skyscrapers crowded in the region. They would not only limit the area for planting, but, maybe more seriously, block the sunlight which causes the tree hard to survive. So the government must measure the shadow area on the ground which caused by these high buildings precisely before they take the next step.

Buildings are rectangular blocks. And you are given a sunlight direction and the location of all the buildings in the region. Your job is to calculate the exact shadow area on the ground.


The first line of input contains one integer, T (T ≤ 20), the number of test cases. Each case starts with a separate line containing three floating number, H, X, Y(0<H≤200, -200≤X,Y≤200), which specify the direction of sunlight, that is, if there is a object at (0,0,H), its shadow on the ground will be located at (X, Y, 0). The next line of the case contains a single integer, N (N≤20), the number of high buildings. The following N lines describe these N buildings separately. The i-th line consists of seven floating numbers, xi1, yi1, xi2, yi2, xi3, yi3 and hi(-2,000,000≤ xi1, yi1, xi2, yi2, xi3, yi3≤ 2,000,000, 0<hi≤200), that is, (xi1, yi1, 0), (xi2, yi2, 0), (xi3, yi3, 0) is three corner of the rectangular base of the building and hi stands for the height of the building.


For each test case, print one line in the following format,
Case t: S
where t stands for the case id (1-based) and S is a floating number with three digits after decimal point which stands for the total shadow area on the ground.

Sample Input

1 2 3
0 0 2 0 2 1 10
1 2 3
0 0 2 0 2 1 10
0 2 2 2 2 3 4

Sample Output

Case 1: 80.000
Case 2: 95.000


[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator