Data Structures & AlgorithmsVery hardCAT · Codeforces Div2 B

How many indices i in [1, 500] satisfy both that i is divisible by 3 and that i+1 is divisible by 5?

  1. A. 166
  2. B. 33
  3. C. 100
  4. D. 233

Correct answer: B. 33

i ≡ 0 (mod 3) and i ≡ 4 (mod 5) combine by CRT to i ≡ 9 (mod 15): 9, 24, ..., 489 = 33 values. 166 checks only divisibility by 3, 100 only the second condition, and 233 counts numbers meeting either condition.

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

Exams that ask this topic