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

Homework

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 216    Accepted Submission(s): 39


Problem Description
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<s2, variable t obeys a continuous uniform distribution. Its probability density function is:



If s1=s2, variable t takes constant value s1.
In probability theory, a probability density function (pdf), or density of a continuous random variable, is a function that describes the relative likelihood for this random variable to take on a given value. The probability for the random variable to fall within a particular region is given by the integral of this variable¡¯s density over the region. The probability density function is nonnegative everywhere, and its integral over the entire space is equal to one.
XXX cannot engage in different projects at the same time. He wants to arrange the order of his projects to be done properly, so that the probability that all projects are finished before or just meet the deadline is maximized.
 

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

Output
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.
 

Sample Input
2 1 1 3 1 3 3 2 1 1 3 2 2 2 0
 

Sample Output
1/2 Congratulations!
 

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-02 07:00:34, Gzip enabled