| IU Programming Challenge 2024 |
|---|
| Finished |
You are playing Whack-a-mole! There are $$$n$$$ holes arranged in a straight line, each with a mole hiding inside. The game lasts $$$n$$$ seconds. At the start of each second after the game begins, exactly one mole, chosen uniformly at random from the moles that are still hiding, jumps out of its hole for one second. Each mole will jump out of its hole exactly once. To win the game, each mole must be whacked during the second that it jumps out of its hole.
Unfortunately, you are much too slow for this game. That is why you've designed a pair of trusty mole-whacking robots! One robot starts at hole $$$1$$$, and the other starts at hole $$$n$$$. Each robot can move at most a distance of $$$v$$$ holes per second. The time it takes to whack a mole is negligible.
Assuming that the robots move optimally, what is the probability that they win the game for you?
The only line of input contains two integers $$$n$$$ and $$$v$$$ ($$$1 \leq v \leq n \leq 8$$$) — the number of holes and the speed of the robots, respectively.
Output the probability that the robots will win the game as a real number.
Your answer will be considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, if the jury's answer is $$$a$$$ and your answer is $$$b$$$, then for $$$b$$$ to be considered correct, $$$\frac{|b - a|}{\max(|a|, 1)} \leq 10^{-6}$$$.
5 1
0.716666666666667
4 1
1.000000000000000
| Name |
|---|


