Data Structures & AlgorithmsHardCodeforces Div2 B-D · ICPC regional

What is the smallest positive integer divisor d such that the sum of ceil(x / d) over [1, 2, 5, 9] is at most 6?

  1. A. 5
  2. B. 6
  3. C. 4
  4. D. 7

Correct answer: A. 5

The sum of ceilings is non-increasing in d, so binary search finds the smallest valid divisor. Using floor division instead of ceiling gives a smaller sum and a wrong divisor.

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

Exams that ask this topic