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

建议使用的浏览器:

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

2984:Jewel Trading

题目描述
You want to sell a diamond to a merchant for a good price. You know so much about how merchant likes the diamond that you have even built a mathematical model for it: He will definitely accept the price p if it's not greater than a certain threshold a, but for a price p higher than it, he must have a think. The higher the price, the lower probability he will accept. Precisely, the probability that he accept price p > a is 1/(1 + (p - a)b) , where b > 1 is a positive constant in your model.



The exact trading process is as follows: you first propose a price (a non-negative integer), then the merchant decides whether to accept. If he accepts, the trade is over and you have no chance to regret. If he does not accept, you propose another price, and so on. You know that the merchant would get angry if you always propose unacceptable high prices, so you promised that the n -th proposal (if there is) is always not greater than a (which he can accept for sure).

Write a program to find an optimal way to propose prices to maximize your expected earning (i.e. the final price).
输入解释
The input consists of several test cases. Each case is described by two positive integers n , a , and a real number b (1<=n<=100, 1<=a<=1000, 1 < b < 10) , b is given to up to three decimal places. The last test case is followed by a single zero, which should not be processed.
输出解释
For each test case, print the case number and the expected earning, to two decimal places. It is guaranteed that the maximal earning exists.
输入样例
1 10 2 
10 33 3.14 
0
输出样例
Case 1: 10.00 
Case 2: 34.41
来自杭电HDUOJ的附加信息
Recommend gaojie

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

源链接: HDU-2984

最后修改于 2020-10-25T22:58:55+00:00 由爬虫自动更新

共提交 0

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