Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional

What is the smallest positive integer x such that the sum of floor(x / a_i) over a = [2, 3, 5] is at least 20?

  1. A. 20
  2. B. 21
  3. C. 22
  4. D. 23

Correct answer: A. 20

The function sum(floor(x / a_i)) is non-decreasing in x, so binary search finds the first x that reaches 20. Checking at the boundary value gives a different threshold.

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

Exams that ask this topic