Data Structures & AlgorithmsVery hardCAT · Codeforces Div2 B

How many integers x with 1 <= x <= 600 are divisible by 4 or 6 but not by 12?

  1. A. 151
  2. B. 147
  3. C. 155
  4. D. 150

Correct answer: D. 150

Use inclusion-exclusion: multiples of 4 plus multiples of 6 minus multiples of 12 gives multiples of 4 or 6; then remove multiples of 12 explicitly.

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

Exams that ask this topic