Data Structures & AlgorithmsHardGATE CS · Codeforces Div2 B

How many unordered pairs {a, b} with 1 <= a < b <= 12 have a + b divisible by 4?

  1. A. 16
  2. B. 15
  3. C. 17
  4. D. 19

Correct answer: B. 15

Group the numbers 1 to 12 by residue mod 4 (three of each residue) and count compatible residue pairs: 0 with 0, and 1 with 3, 2 with 2.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic