Dice Betting
Time limit2sMemory limit512 MB
Compute the probability that at least k distinct values appear when an s-sided die is rolled n times, and print it to nine decimals.
- Level
Medium6 of 10
- Topics
- Probability, Dynamic programming, Combinatorics, Math
- Solved
- No attempts yet
Problem
Gunnar and his friends like games that involve rolling dice. Gunnar owns a huge collection of 6-sided, 12-sided and 20-sided dice. Every dice game he knew had become boring, so he invented a new one. He rolls an -sided die times and wins if at least different numbers appear in those throws. An -sided die carries the numbers to on its sides, one distinct number per side.
The game has a single player, so Gunnar and his friends made it more fun by letting other people bet on a round. Before you bet, you want to know how probable it is to throw at least different numbers in throws with an -sided die. Every number is equally likely on each throw.
Input
The only line contains three integers , and in this order (, ). is the number of throws, is the number of sides of the die, and is the number of different numbers needed to win.
Output
Print one line with the probability that at least different numbers appear in throws of an -sided die. Round the value to nine digits after the decimal point and pad with zeros so that exactly nine digits follow the decimal point. A probability of prints as 1.000000000 and a probability of prints as 0.000000000.