Mathematics (JEE)Very hardCodeforces Div2 D

In how many ways can 9 distinct balls be placed into 4 distinct boxes so that no box is empty?

  1. A. 7770
  2. B. 186480
  3. C. 183412
  4. D. 262144

Correct answer: B. 186480

Inclusion-exclusion over empty boxes gives sum (-1)^j C(4,j)(4-j)^9 = 186480, which is 4! times S(9,4) = 7770.

More Permutations, Combinations and Probability questions

Exams that ask this topic