#C8717. Drone Delivery Optimization

    ID: 52730 Type: Default 1000ms 256MiB

Drone Delivery Optimization

Drone Delivery Optimization

You are tasked with optimizing drone deliveries. Each drone has a specified initial battery life and a fixed energy cost per delivery. For each drone, compute how many deliveries it can make before its battery is insufficient. The calculation is done by taking the floor of the division between the drone's battery life and the energy cost per delivery:

\( deliveries = \left\lfloor \frac{battery}{energy\ per\ delivery} \right\rfloor \)

The input contains multiple datasets. Each dataset starts with an integer \(N\), representing the number of drones. A dataset with \(N = 0\) signals the end of input. For each dataset, you are given a line of \(N\) integers denoting the battery lives of the drones, followed by a line with the energy cost per delivery. Your program should output one line per dataset with the computed maximum deliveries for each drone, separated by spaces.

inputFormat

The input consists of multiple datasets. Each dataset is structured as follows:

  • An integer \(N\) indicating the number of drones. If \(N = 0\), then the input terminates.
  • A line with \(N\) space-separated integers representing battery life values for each drone.
  • A line with a single integer representing the energy consumption per delivery.

Datasets continue until a dataset with \(N = 0\) is encountered.

outputFormat

For each dataset, output a single line containing \(N\) integers. Each integer is the maximum number of deliveries a drone can perform, computed as \(\lfloor battery / energy\_per\_delivery \rfloor\). The values should be space-separated.

## sample
3
10000 15000 20000
2000
2
9000 5000
1000
0
5 7 10

9 5

</p>