Data Structures & AlgorithmsModerateGATE CS · Codeforces Div2 B

How many integers x with 1 <= x <= 500 satisfy x mod 7 = x mod 11?

  1. A. 49
  2. B. 48
  3. C. 42
  4. D. 6

Correct answer: B. 48

x mod 7 = x mod 11 = r means x ≡ r (mod 77) with 0 ≤ r ≤ 6, so 7 of every 77 integers qualify: 6 full blocks give 42, and 462–468 add 7 more, minus x = 0, giving 48. Including 0 gives 49, skipping the partial block gives 42, and 6 counts blocks.

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

Exams that ask this topic