Problem Statement | |||||||||||||
A big box contains marbles of one or more colors. You're given a int[] colors, each element of which denotes the number of marbles there are of a particular color. You draw n marbles randomly from the box, leaving each marble outside the box after taking it. Return the probability that all marbles drawn will be the same color. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | Every time we draw a marble, all marbles in the box are equally likely to be chosen. | ||||||||||||
- | A return value with either an absolute or relative error of less than 1.0E-9 is considered correct. | ||||||||||||
Constraints | |||||||||||||
- | colors will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of colors will be between 1 and 50, inclusive. | ||||||||||||
- | n will be between 1 and the sum of all elements of colors, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|