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

Strange Galaxy

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/32768 K (Java/Others)
Total Submission(s): 102    Accepted Submission(s): 50


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 ¨C 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 ¨C 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.
 

Sample Input
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
 

Sample Output
INF 40.00% ZERO
 

Author
hzw0106
 

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-09 08:05:35, Gzip enabled