|
||||||||||
Fairies' DefenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 213 Accepted Submission(s): 4 Problem Description There are n fairies living happily in the Fairyland. One day, when the fairies are playing games, they are suddenly stuck in the sky and cannot move anymore! "Your moving abilities are sealed by my magic. Be ready to defense my attack!" a terrible voice came out, "I'll appear in the cube (0, 0, 0)-(a, b, c), rush to the nearest fairy and then, make my assault with all my power!" Since all the fairies cannot move any more, the only chance is to redistribute their defense powers according to their dangerousness. Formally, the defense power one fairy gains should be proportional to its probability to be attacked by the unknown fierce creature. Write a program to compute the probability to be attacked, for every fairy. You may assume that the probability density of the attacker's initial position is the same everywhere in the cube; if there are at least two fairies closest (having the minimal Euclidean distance) to the initial position, any one may be attacked. Input The input consists of several test cases. The first line of each case contains four integers, n, a, b, c (2 ¡Ü n ¡Ü 20, 1 ¡Ü a, b, c ¡Ü 1000). This is followed by n lines, each containing three integers x, y, z (0 ¡Ü x ¡Ü a, 0 ¡Ü y ¡Ü b, 0 ¡Ü z ¡Ü c), the coordinates of the fairies. No two fairies occupy the same position. The last test case is followed by a single zero, which should not be processed. Output For each test case, print the case number and the probabilities for every fairy, to three decimal places. Sample Input
Sample Output
Source | ||||||||||
|