eolymp
bolt
Try our new interface for solving problems
Problems

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

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

\includegraphics{https://static.e-olymp.com/content/b5/b5d07c2af7568517977a2ca8e74eccbc4df108ad.jpg} The player starts with a prize of $\$1$ and is asked a sequence of $n$ questions. For each question, he may \begin{itemize} \item quit a game and keep his prize. \item answer the question. If wrong, he quits with nothing. If correct, the prize is doubled, and he continues with the next question. \end{itemize} After the last question, he quits with his prize. The player wants to maximize his expected prize. Once each question is asked, the player can 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$. \InputFile Each line is a separate test case with two numbers: an integer $n~(1 \le n \le 30)$ and a real $t~(0 \le t \le 1)$. Input is terminated by a line containing two zeroes. This line should not be processed. \OutputFile For each test case print the player's expected prize if he plays the best strategy. Output should be rounded to three fractional digits.
Time limit 1 second
Memory limit 128 MiB
Input example #1
1 0.5
1 0.3
2 0.6
24 0.25
0 0
Output example #1
1.500
1.357
2.560
230.138