#P11599. Kuafu's Pursuit of the Sun
Kuafu's Pursuit of the Sun
Kuafu's Pursuit of the Sun
In the far north, there lives a giant named Kuafu. On a bitterly cold winter night, he finds himself sleepless due to the chill. In a flash of inspiration, he thinks: if he can catch up with the sun, thereby making the sun linger longer over the human world, the people would enjoy some extra warmth. Given that the current distance to the sun is \(n\) and Kuafu can cover a distance of \(x\) per day, if he were to pursue the sun continuously, it would take \(\lceil \frac{n}{x} \rceil\) days to catch it. However, Kuafu has an energy level of \(k\), and every day he pursues the sun, he loses 1 unit of energy. He can only move forward on a day if his energy is greater than 0. At any point during his pursuit, he can opt to rest for one day to fully recover his original energy \(k\). Determine the minimum number of days required for Kuafu to catch the sun.
inputFormat
The input consists of three space-separated positive integers: \(n\) (the distance to the sun), \(x\) (the distance Kuafu can cover in one day), and \(k\) (Kuafu's initial energy).
outputFormat
Output a single integer, the minimum number of days required for Kuafu to catch the sun.
sample
10 3 2
5