Mathematics (JEE)Very hardCodeforces Div2 D

How many functions f from {1, 2, 3, 4, 5} to {1, 2, 3} satisfy f(1) = 1 and f is onto?

  1. A. 81
  2. B. 150
  3. C. 50
  4. D. 49

Correct answer: C. 50

With f(1) = 1 fixed, f(2),...,f(5) must hit both 2 and 3; inclusion-exclusion gives 81 - 2*16 + 1 = 50.

More Permutations, Combinations and Probability questions

Exams that ask this topic