#K1081. Parcel Delivery Trips
Parcel Delivery Trips
Parcel Delivery Trips
You are given a fleet of (n) robots, each assigned a certain number of parcels. Each robot can carry a maximum of (x) parcels per trip. The task is to determine the minimum number of trips each robot must make to transport all of its parcels as well as the total number of trips made by all robots. For the (i^{th}) robot, the number of trips is calculated using the formula: [ trips_i = \left\lceil \frac{parcels_i}{x} \right\rceil ]
The input consists of three lines:
- An integer (n) representing the number of robots.
- A line containing (n) space-separated integers (p_1, p_2, \ldots, p_n) where each (p_i) denotes the number of parcels assigned to the (i^{th}) robot.
- An integer (x) representing the maximum number of parcels a robot can carry in a single trip.
Your program should output two lines:
- The first line should print (n) space-separated integers, where the (i^{th}) integer is the number of trips made by the corresponding robot.
- The second line should print a single integer, the total number of trips made by all robots.
inputFormat
Input is read from stdin and consists of three lines:
- An integer (n) denoting the number of robots.
- (n) space-separated integers representing the parcels for each robot.
- An integer (x) representing the maximum number of parcels that can be carried in one trip.
outputFormat
Output is printed to stdout. The output consists of two lines:
- The first line contains (n) space-separated integers, each representing the number of trips for a robot.
- The second line contains a single integer, representing the total number of trips.## sample
5
10 20 30 40 50
10
1 2 3 4 5
15
</p>