2141 - So you want to be a 2n-aire? 2141 - So you want to be a 2n-aire? 2141 - So you want to be a 2n-aire?

Statistics Sub: 49 | AC: 30 | AC%: 61,22 | Score: 2,99
Created by 2005 Waterloo Local Contest
Added by ymondelo20 (2012-11-13)
Limits
Total Time: 5000 MS | Test Time: 2000 MS |Memory: 62 MB | Output: 64 MB | Size: 29 KB
Enabled languages
Available in

Description

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.
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.
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 specification

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.
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.
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 specification

For each input n and t, print the player's expected prize, if he plays the best strategy. Output should be rounded up to two decimal places.
For each input n and t, print the player's expected prize, if he plays the best strategy. Output should be rounded up to two decimal places.
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.

Sample input

1 0.5
1 0.3
2 0.6
24 0.25
0 0

Sample output

1.50
1.36
2.56
230.14

Hint(s)

http://coj.uci.cu/24h/
http://coj.uci.cu/24h/
http://coj.uci.cu/24h/

Recommendation

We have carefully selected several similar problems: 3376 | 2156 | 2243 | 2769 | 1873 | 2441