Premium problem88. Exactly k Aces

Medium Locked

Deal n cards from a 52-card deck without replacement. Return the probability of getting exactly k aces.

This is hypergeometric, not binomial: the draws are not independent, because every card taken changes what is left.

P=(4k)(48n−k)(52n)P = \frac{\binom{4}{k}\binom{48}{n-k}}{\binom{52}{n}}

Input

n = 5
k = 1

Output

0.2994736356080894

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)