#P9833. Cows' Fueling Adventure

    ID: 22978 Type: Default 1000ms 256MiB

Cows' Fueling Adventure

Cows' Fueling Adventure

A group of cows has hijacked a truck and set out to explore a forest. Unfortunately, due to their terrible driving skills, the truck's fuel tank was damaged so that it leaks one unit of fuel for every unit distance traveled. To fix the tank and reach the nearest city (which is guaranteed to be within 10610^6 units), the cows must refuel at one of the nn available fuel stations located between their current position and the city. At each fuel station, they can refuel an amount between 1 and 100 units. Note that the truck's fuel tank has an infinite capacity, so there is no upper limit on the fuel it can carry.

The truck is currently ll units away from the city and has pp units of fuel. Since the truck loses one unit of fuel per unit distance traveled, the goal is to determine the minimum number of fuel stops required to reach the city. Formally, you need to find the smallest non-negative integer kk such that

p+100×kl,p + 100\times k \geq l,

with the additional constraint that knk\le n. If no such kk exists, output -1.

This problem can be solved by checking if the initial fuel is enough. If not, compute the additional fuel needed and divide it by 100 (using ceiling division) to determine the minimum number of stops.

inputFormat

The input consists of a single line containing three integers nn, ll, and pp, where:

  • $n$ is the number of fuel stations available (i.e. the maximum number of stops allowed),
  • $l$ is the distance from the current location to the city,
  • $p$ is the current amount of fuel in the truck.
It is guaranteed that $l \leq 10^6$.

outputFormat

Output a single integer: the minimum number of fueling stops required to reach the city. If it is impossible to reach the city under the given constraints, output -1.

sample

5 500 500
0