#P3733. Shadow Area

    ID: 2742 远端评测题 1000ms 64MiB 尝试: 0 已通过: 0 难度: (无) 上传者: 标签>PKU Campus 2009 (POJ Monthly Contest – 2009.05.17), Rainer

Shadow Area

Description

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.

Input

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.

Output

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.

2
1 2 3
1
0 0 2 0 2 1 10
1 2 3
2
0 0 2 0 2 1 10
0 2 2 2 2 3 4
Case 1: 80.000
Case 2: 95.000

Source

PKU Campus 2009 (POJ Monthly Contest – 2009.05.17), Rainer