ZOJ Problem Set - 2102
Granny likes dropping around in the neighborhood. She is rather aged so she always carries a stick to assist walking. When she comes to a house, she wants to put her stick somewhere, actually anywhere but on the ground, otherwise she has to bend over to pick it up and what a misery it is for her! So she finds some round tables. Err�� so far so good, except the fact that, you know, she is not a physicist. She takes out a PDA and calculates whether the stick will fall to the ground. And she is so proud that the software is written by you, her favorite grandchild.
Input contains multiple test cases. Each case begins with an integer N (0 < N <= 10000) - the number of round tables. N lines follow, each of which contains three integers, xi, yi and ri - the center and radius of the ith round table. Tables do not overlap with each other. The last line contains four integers x1, y1, x2 and y2, where (x1, y1) and (x2, y2) is the two end points of the stick. You may assume the stick is thin and its mass is equally distributed.
A test case with a single 0 signals the end of input, and this test case is not to be processed.
One line for each test case, which contains a single word "STAY" or "FALL". Granny is a reasonable person and she will not bother the program about cases that it might or might not fall. But unfortunately, as mentioned earlier, she is unable to instruct you about physics.
Author: WU, Jiazhi
Source: Zhejiang University Local Contest 2004