Tournament Wins
Time limit1sMemory limit512 MB
In a random single elimination bracket of 2^k players, you are ranked r; find your expected number of wins.
- Level
Medium6 of 10
- Topics
- Probability, Combinatorics
- Solved
- No attempts yet
Problem
You are one of competitors in a single elimination tournament. The published rankings place you th, and rank 1 is the strongest. In any match the higher ranked player always wins, so the player with the smaller rank number advances.
The bracket is the only source of uncertainty. Every way of assigning the competitors to the bracket slots is equally likely. Determine your expected number of wins, the average of your win count over all bracket orderings.
Input
The input is a single line containing the two space separated integers () and ().
Output
Print your expected number of wins on a single line, rounded to exactly five decimal places. The sixth digit after the decimal point of the exact answer is never 4 or 5, so the rounding is never ambiguous.
Intermediate values can become very small or very large, so pick your arithmetic with care.