Marichka Turns the Lamps On
Limits: 2 sec., 256 MiB
Zenyk has \(m\) lamps, numbered from 1 to \(m\), and an integer \(n < m\).
Zenyk randomly chooses an integer \(k\) from 0 to \(n\) with equal probability. Then Marichka randomly chooses a set of \(k\) lamps with equal probability and turns them on.
Zenyk is interested in probability that all turned on lamps will have numbers not greater than \(n\).
Input
The single line contains two integers \(m\) and \(n\), where \(m\) is the number of lamps.
Output
In the single line print a real number – the required probability multiplied by \(n+1\).
Your answer is considered correct if its absolute or relative error doesn’t exceed \(10^{-7}\).
Constraints
\(0 \le n < m \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 2 1 | 1.5 |
Notes
Provided \(k=0\), Marichka doesn’t turn on any lamp. Thus all turned on lamps have numbers not more than 1.
If Zenyk chooses \(k=1\), Marichka can turn on the first or the second lamp. The number of the turned on lamp doesn’t exceed 1 with probability 0.5.
The probability to choose each value of \(k\) equals to 0.5.
The required probability equals to \(0.5 \cdot 1 + 0.5 \cdot 0.5 = 0.5 \cdot 1.5\).
The answer to the problem equals to 1.5 – probability, multiplied by \(n+1=2\).
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|