当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4459:Homework

题目描述
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.
输入解释
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.
输入样例
2
1 1 3
1 3 3
2
1 1 3
2 2 2
0
输出样例
1/2
Congratulations!
来自杭电HDUOJ的附加信息
Recommend

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4459

最后修改于 2020-10-25T23:13:43+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)