![Computers and Technology](/tpl/images/cats/informatica.png)
Computers and Technology, 18.04.2021 04:50, Bryoh
You are responsible for a rail convoy of goods consisting of several boxcars. You start the train and after a few minutes you realize that some boxcars are overloaded and weigh too heavily on the rails while others are dangerously light. So you decide to stop the train and spread the weight more evenly so that all the boxcars have exactly the same weight (without changing the total weight). For that you write a program which helps you in the distribution of the weight.
Your program should first read the number of cars to be weighed (integer) followed by the weights of the cars (doubles). Then your program should calculate and display how much weight to add or subtract from each car such that every car has the same weight. The total weight of all of the cars should not change. These additions and subtractions of weights should be displayed with one decimal place. You may assume that there are no more than 50 boxcars.
Example 1
In this example, there are 5 boxcars with different weights summing to 110.0. The ouput shows that we are modifying all the boxcars so that they each carry a weight of 22.0 (which makes a total of 110.0 for the entire train). So we remove 18.0 for the first boxcar, we add 10.0 for the second, we add 2.0 for the third, etc.
Input
5
40.0
12.0
20.0
5. 33.
0
Output
- 18.0
10.0
2.0
17.0
-11.0
![answer](/tpl/images/cats/otvet.png)
Answers: 2
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 17:30, cxttiemsp021
Per the municipal solid waste report, what are the most common sources of waste (trash
Answers: 3
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 20:00, noah12345678
What multimedia system creates an immersive, real-life experience that the user can interact with?
Answers: 1
Do you know the correct answer?
You are responsible for a rail convoy of goods consisting of several boxcars. You start the train an...
Questions in other subjects:
![Konu](/tpl/images/cats/geografiya.png)
Geography, 06.01.2020 07:31
![Konu](/tpl/images/cats/istoriya.png)
History, 06.01.2020 07:31
![Konu](/tpl/images/cats/mat.png)
Mathematics, 06.01.2020 07:31
![Konu](/tpl/images/cats/biologiya.png)
Biology, 06.01.2020 07:31
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 06.01.2020 07:31
![Konu](/tpl/images/cats/en.png)
English, 06.01.2020 07:31
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 06.01.2020 07:31
![Konu](/tpl/images/cats/istoriya.png)
History, 06.01.2020 07:31