#P5081. Coupon Collector's Problem
Coupon Collector's Problem
Coupon Collector's Problem
Given a bag with N balls, each ball is indistinguishable and every time a ball is drawn uniformly at random and then replaced. Compute the expected number of draws needed so that every ball in the bag has been drawn at least once.
The expected number can be expressed as:
$$ E = N \times \sum_{i=1}^{N} \frac{1}{i} $$
inputFormat
The input consists of a single integer N
(1 ≤ N ≤ 10^6), which represents the number of balls in the bag.
outputFormat
Output a real number which is the expected number of draws required. Your answer is accepted if the absolute or relative error does not exceed 1e-6.
sample
1
1.000000