610. Ilya and Escalator
0
Medium
Ilya has decided to take a break from sports programming and has started working in the subway. His new task is to calculate the load factor of an escalator.
Assuming that there are n people waiting in a queue for the escalator, one of two possibilities occurs every second: either the first person in the queue enters the escalator with a probability of p, or the first person in the queue remains stationary with a probability of (1 - p), causing the entire queue to wait behind them due to their fear of escalators.
Formally, the i-th person in the queue cannot enter the escalator until people with indices from 1 to i - 1 have entered it. Only one person can enter the escalator in one second. Since the escalator is infinite, once a person enters it, they will remain on it indefinitely. Ilya needs to calculate the expected value of the number of people standing on the escalator after t seconds.
Your task is to assist Ilya in solving this complex problem.
Input Format
The first line of the input consists of three numbers: n, p, t. The values of n and t are integers, while the value of p is a real number with exactly two digits after the decimal point.
Output Format
Output a single real number, representing the expected number of people who will be standing on the escalator after t seconds. The absolute or relative error should not exceed 10 -6.
Example
Input
1 0.50 1
Output
0.5
Constraints
1 ≤ n, t ≤ 2000, 0 ≤ p ≤ 1
Loading...
View Submissions
Console