问题3934--Homework

3934: Homework

[命题人 : ]
时间限制 : 3.000 sec  内存限制 : 64 MB

题目描述

XXX always procrastinate over his homework. This time, he is wondering that if he can finish all his projects before deadline. There are n (2<=n<=5) projects to do. Each projects has a deadline d (1<=d<=1000) which means that this project must be finished no later than d o'clock. For each project, there is an interval [s1, s2] (1<=s1<=s2<=200) meaning that XXX will spend at least s1 hours and at most s2 hours to finish it. Let random variable t denotes that it takes t hours to finish the project. (Note that t may take real values). If s1

输入

There are no more than 3000 cases. For each case, the first line begins with an integer n --- the number of projects. Each of the following n lines describes one project which contains three integers --- the above mentioned s1, s2 and d. The input ends by n=0.

输出

For each test case, output the answer in one line. If the probability is 0, then output “Poor boy!” without quotes. If the probability is 1, then output “Congratulations!” without quotes. If the probability is between 0 and 1 exclusive, then output a fraction to represent the probability. The numerator and the denominator should be positive and co-prime.

样例输入 Copy

2
1 1 3
1 3 3
2
1 1 3
2 2 2
0

样例输出 Copy

1/2
Congratulations!

来源/分类