Mathematics (JEE)Very hardCodeforces Div2 C

How many nonempty subsets of {1, 2, ..., 10} have an element sum that is divisible by 5?

  1. A. 208
  2. B. 204
  3. C. 207
  4. D. 205

Correct answer: C. 207

A roots-of-unity filter over residues mod 5 counts (2^10 + 4 * 4)/5 = 208 subsets including the empty set, since the product over 1..10 of (1 + w^k) equals 4 for each primitive 5th root w; removing the empty set gives 207.

More Permutations, Combinations and Probability questions

Exams that ask this topic