Collecting Every Card
Time limit5sMemory limit512 MB
Find the expected number of booster packs to buy, each pack giving N distinct kinds, until all C kinds are collected.
- Level
Medium7 of 10
- Topics
- Probability, Dynamic programming, Combinatorics, Math
- Solved
- No attempts yet
Problem
A new card set has different kinds of card. The cards are sold only in booster packs, and each pack holds cards whose kinds are all different. The contents of a pack are one of the ways to choose kinds out of the kinds, and every one of those combinations comes up with the same probability each time you buy a pack.
You buy packs one at a time and keep buying until you own all kinds. Compute the expected number of packs you buy.
Input
The first line contains the number of test cases . Each of the next lines contains and separated by a space.
Constraints
Output
For each test case, print one line in the following format.
Case #x: E
Here is the test case number starting from 1, and is the expected number of packs. Round at the eighth digit after the decimal point and always print exactly seven digits after the decimal point. A whole number prints as .