#P6633. Expected Card Drawing Rounds
Expected Card Drawing Rounds
Expected Card Drawing Rounds
Bob loves drawing cards. Recently he got into a gacha game called "主公连结". In this game, there are ( n ) distinct characters numbered from (1) to (n). Bob can form his theoretically strongest team once he obtains ( k ) cards with consecutive numbers. At present, the card pool consists of ( m ) distinct cards. In each round, Bob draws one card uniformly at random from the pool. If he draws a card he already owns, nothing happens and that round is wasted. Bob will continue drawing cards until his collection contains a set of ( k ) consecutive cards. Calculate the expected number of rounds Bob needs to achieve this.
Note: For the purpose of this problem, assume that the ( m ) cards available are exactly those numbered from (1) to (m) (with ( m \le n )), and a winning condition is met when there exists an integer ( i ) (with (1 \le i \le m-k+1)) such that Bob has all cards with numbers ( i, i+1, \dots, i+k-1 ).
inputFormat
The input consists of a single line containing three integers ( n, m, k ) (with (1 \le k \le m \le n)).
outputFormat
Output a single number representing the expected number of rounds to obtain ( k ) consecutive cards. The answer is accepted if its absolute or relative error does not exceed (10^{-6}).
sample
5 5 3
4.166667