#P3882. Strange Galaxy
Strange Galaxy
Problem Description
ACM space explorer discovered a special space in an observation. There are many strange stars in it, and we call them S-stars. Each three of them, such as A, B, C, can form an opaque triangle area ABC, and the area can absorb the light inside O-ABC for the point light source O which made O can only light the space except an infinite triangular file shaped space whose boundaries are ray OA, OB and OC.
In order to know the size of the area that a point light source O can light at a specific direction, we normally choose a plane P as reference, consider O’s invisible area in P. If the area size is infinite or 0, we consider the direction as a bad one. We take this direction as a reference only if the area size is finite and non-zero.
Then we’ll give you another set of normal stars, we’d like to know the percentage of those couldn’t be lighted among all the normal stars.
Input
Multiple cases, no more than 100, test case ends with four zeros.
All numbers are integers, in each case:
Line 1: a, b, c and d, represent the reference plane: ax+by+cz=d;
Line 2: n (0<n<=100), number of S-stars
Line 3 – n+2: x, y and z, coordinate of each S-star
Line n+3: x0, y0 and z0, coordinate of point light source O
Line n+4: m (0<m<100), number of normal stars
Line n+5 – n+m+4: x, y and z, coordinate of each normal star
Notice: S-star and normal star may coincide. We guarantee that if there exist S-stars, they are not all at the same plane. The point light source is not on the reference plane and doesn’t coincide with other stars. The absolute value of each coordinate number is below 10000.
Output
For each test case, if the invisible area size is 0, output “ZERO”, if it’s infinite, output “INF”, otherwise output the percentage described above, rounded to two decimal numbers.
0 0 1 0
8
1 1 1
1 -1 1
-1 1 1
-1 -1 1
1 1 0
1 -1 0
-1 1 0
-1 -1 0
2 2 1
4
0 0 1
0 0 0
0 1 0
1 0 1
1 0 0 -2
8
1 1 1
1 1 -1
1 -1 1
1 -1 -1
-1 1 1
-1 1 -1
-1 -1 1
-1 -1 -1
2 0 0
10
1 0 0
2 0 0
-1 -1 1
1 1 -1
0 0 0
2 0 0
3 0 0
2 2 2
1 -1 -1
-1 1 -1
1 1 1 1
0
0 0 0
1
1 1 1
0 0 0 0
INF
40.00%
ZERO
Author
hzw0106