Problem Statement | |||||||||||||
A juice company is running a promotion where each juice bottle they sell contains a code that you can redeem for a prize. There are n different codes, each corresponding to a different type of prize. The codes are evenly distributed, so the probability of winning a certain type of prize is 1/n for each bottle. The codes are written underneath the bottle caps, so you can't read them until you buy the bottles. Your goal is to collect k different types of prizes. Return the expected number of bottles you must buy to achieve this goal. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | The returned value must be accurate to within a relative or absolute value of 1E-9. | ||||||||||||
Constraints | |||||||||||||
- | n and k will contain digits ('0' - '9') only. | ||||||||||||
- | n and k will represent positive integers without leading zeros. | ||||||||||||
- | n will represent an integer between 1 and 10^18, inclusive. | ||||||||||||
- | k will represent an integer between 1 and the integer n represents, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|