#C1925. Minimum Refueling Stops

    ID: 45184 Type: Default 1000ms 256MiB

Minimum Refueling Stops

Minimum Refueling Stops

You are given T trucks, each with a delivery distance provided in a list, and a maximum travel distance D that a truck can cover on a full tank. Your task is to determine the minimum number of refueling stops required for each truck in order to complete its journey.

For a truck that has to travel a distance d:

  • If d \leq D, then no refueling stops are needed (i.e. answer is 0).
  • If d > D, then the number of stops is calculated as:

\( stops = \begin{cases} \left\lfloor\frac{d}{D}\right\rfloor - 1, &\text{if } d\;\%\;D = 0 \\ \left\lfloor\frac{d}{D}\right\rfloor, &\text{if } d\;\%\;D \neq 0 \end{cases}\)

Note that the input will be provided in standard input (stdin) and your program should output your results to standard output (stdout).

inputFormat

The first line contains two integers T and D, where T is the number of trucks and D is the maximum distance a truck can travel on a full tank.

The second line contains T space-separated integers representing the distances each truck has to travel.

outputFormat

Output a single line with T space-separated integers. Each integer represents the minimum number of refueling stops required for the corresponding truck.

## sample
3 100
150 250 300
1 2 2