#P1291. Coupon Collector's Beverage Bottles
Coupon Collector's Beverage Bottles
Coupon Collector's Beverage Bottles
In this problem, you are given an integer n representing the number of different ball star names. Each name appears with an equal probability on the label of a beverage bottle. Your task is to calculate the average number of beverage bottles one needs to purchase in order to collect all n distinct names.
This is a classic Coupon Collector's Problem. The expected number of bottles required is given by the formula:
\[ E = n \times \left(\sum_{i=1}^{n} \frac{1}{i}\right) \]
Print the result rounded to 4 decimal places.
inputFormat
The input consists of a single integer n (1 ≤ n ≤ 105), which represents the number of different ball star names.
outputFormat
Output the expected number of beverage bottles required to collect all names, rounded to 4 decimal places.
sample
1
1.0000