#B3706. Minimum Truck Trips for Beer Transportation

    ID: 11365 Type: Default 1000ms 256MiB

Minimum Truck Trips for Beer Transportation

Minimum Truck Trips for Beer Transportation

A poet owns two warehouses. Warehouse A contains \(x\) liters of beer while Warehouse B initially contains an unknown amount \(y\). If Warehouse A transfers \(z\) liters of beer to Warehouse B, then both warehouses will have the same amount of beer. This gives the equation:

\(x - z = y + z\)

Simplifying, we obtain \(y = x - 2z\).

After the transfer, Warehouse B will contain \(y + z = x - z\) liters of beer. Given a truck that can transport at most \(c\) liters per trip, determine the minimum number of trips needed to transport all the beer from Warehouse B.

inputFormat

The input consists of a single line containing three space-separated integers \(x\), \(z\), and \(c\), where:

  • \(x\) is the amount of beer in Warehouse A.
  • \(z\) is the amount of beer transferred from Warehouse A to Warehouse B.
  • \(c\) is the truck's capacity in liters.

It is guaranteed that \(x \geq 2z\) and that all values are positive integers.

outputFormat

Output a single integer representing the minimum number of trips required for the truck to transport all the beer from Warehouse B after the transfer.

sample

10 3 3
3