当前位置:网站首页>English topic assignment (25)

English topic assignment (25)

2022-07-06 19:03:00 m0_ sixty-five million seven hundred and eighty-eight thousand

The original title is :

So you want to be a 2n-aire?

 1000ms  32768K

describe :

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 :

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.

Output :

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.

The sample input :

1 0.5
1 0.3
2 0.6
24 0.25
0 0

Sample output :

1.500
1.357
2.560
230.138

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

translate :

Participants can get $$$1 As a bonus , And be asked n A question . For every question , He can quit or stay for his bonus .

Question answering , If it's wrong , Nothing will happen if you quit ; If you're right , Double the bonus , And he can continue to answer the next question .

After the last question , He can quit with his bonus . This contestant wants to get the most prize .

For every question asked , The contestant can estimate the possibility that he can answer p. For each problem, we assume p It is randomly and evenly distributed in the range t···1.

Input :

There are many lines of input , A row contains two numbers : An integer 1<=n<=30, A real number 0<=t<=1. When a line is entered as 0 0 when , Input termination .

Output :

For each input n and t, Output contestants to give full play to their strength , Expected bonus . Output reserved 3 Decimal place .

原网站

版权声明
本文为[m0_ sixty-five million seven hundred and eighty-eight thousand ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131249377148.html