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

建议使用的浏览器:

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

1145:So you want to be a 2n-aire?

题目描述
The player starts with a prize of $1, and is asked a sequence of n questions. For each question, he may
quit and keep his prize.
answer the question. If wrong, he quits with nothing. If correct, the prize is doubled, and he continues with the next question.
After the last question, he quits with his prize. The player wants to maximize his expected prize.
Once each question is asked, the player is able to assess the probability p that he will be able to answer it. For each question, we assume that p is a random variable uniformly distributed over the range t .. 1.
输入解释
Input is a number of lines, each with two numbers: an integer 1 ≤ n ≤ 30, and a real 0 ≤ t ≤ 1. Input is terminated by a line containing 0 0. This line should not be processed.
输出解释
For each input n and t, print the player's expected prize, if he plays the best strategy. Output should be rounded to three fractional digits.
输入样例
1 0.5
1 0.3
2 0.6
24 0.25
0 0
输出样例
1.500
1.357
2.560
230.138
来自杭电HDUOJ的附加信息
Recommend Eddy

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

源链接: HDU-1145

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

共提交 119

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