英语题目作业(25)

原题:

So you want to be a 2n-aire?

 1000ms  32768K

描述:

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

(链接:So you want to be a 2n-aire? | JXNUOJ

翻译:

参加者开始可得$$$1作为奖金,并要被询问n个问题。对于每一个问题,他可以退出或者为了他的奖金留下。

回答问题,如果错了,退出则什么都不会发生;如果对了,奖金翻倍,并且他可以继续回答下一题。

在结束最后一个问题后,他可以带着奖金退出。这个参赛者想得到最多的奖金。

对于每一个被问到的问题,参赛者可以估算出他能回答出的可能性p。对于每一个问题我们假定p是随机均匀分布于范围t···1.

输入:

输入有很多行,一行包括两个数:一个整数1<=n<=30,一个实数0<=t<=1.当一行输入为0 0时,输入终止。

输出:

对于每个输入n和t,输出参赛者发挥最大实力,预计能获得的奖金。输出保留3位小数。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值