Leaks in the Jutge (1)

(This story is more or less based upon real facts.)

Some absent-minded professors inadvertently make the statement of a
problem available to everyone the day before an exam. One student
notices this fact, and in solidarity he warns k other students. Each one
of them warns k other students (all different and who did not know yet),
and so on. Knowing the total number of students n and the constant k,
when will all students be aware?

Input

Input consists of several cases, each with two natural numbers n and k.
Assume 1 ≤ n ≤ 10⁶ and 1 ≤ k ≤ 1000.

Output

For every case, print the moment when all students will be aware.
Suppose that the first student is aware at the moment 1, ant that
transmitting the information requires one unit of time.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:11:25.807Z

© Jutge.org, 2006–2026.
https://jutge.org
