In how many ways can 12 different( not same) coloured balls be distributed among 3 boys so that each gets atleast 1 ball? ans:- 519156
One way : S(12, 3) * 3!
See the link here
------------------------------------------
Other way: Principle of inclusion-exclusion
3^{12} - [ $\binom{3}{1}$ * 2^{12} - $\binom{3}{2}$ * 1^{12}]
= 519156
Gatecse
Hi @
For creating automatas you can also ...