Problem: Logistics

You are responsible for the logistics of different cargos. Depending on the weight of each load is needed different vehicle and costs different price per tonne:

  • Up to 3 tonnesminibus (200 BGN per tonne).
  • From over 3 and up to 11 tonnestruck (175 BGN per tonne).
  • Over 11 tonnes – train (120 BGN per tonne).

Your task is to calculate the average price per tonne of the cargo, and also how much percent of the cargo is transported in each vehicle .

Input Data

From the console is read sequence of numbers, each on separate line:

  • First line: count of the cargos for carriage – integer number in range [1 … 1000].
  • On the next lines is given the tonnage of the current cargointeger number in range [1 … 1000].

Output Data

Print on the console 4 lines, as follows:

  • Line #1the average price per tonne of the cargo (rounded to the second place after the decimal point).
  • Line #2percent of the cargo, carried by minibus (between 0.00% and 100.00%, rounded to the second place after the decimal point).
  • Line #3percent of the cargo, carried by truck (between 0.00% and 100.00%).
  • Line #4percent of the cargo, carried by train (between 0.00% and 100.00%).

Sample Input and Output

Input Output Explanations
4
1
5
16
3
143.80
16.00%
20.00%
64.00%
By minibus are transported two of the cargos 1 + 3, total 4 tonnes.
By truck is transportde one of the cargos: 5 tonnes.
By train is transported one of the cargos: 16 tonnes.
Sum of all cargos is: 1 + 5 + 16 + 3 = 25 tonnes.
Percent of the cargo by minibus: 4/25*100 = 16.00%
Percent of the cargo by truck: 5/25*100 = 20.00%
Percent of the cargo by train: 16/25*100 = 64.00%
Average price per tonne of carried cargo: (4 * 200 + 5 * 175 + 16 * 120) / 25 = 143.80
Input Output Input Output
5
2
10
20
1
7
149.38
7.50%
42.50%
50.00%
4
53
7
56
999
120.35
0.00%
0.63%
99.37%

results matching ""

    No results matching ""