simeonshopov

Logistics

Oct 16th, 2019
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. cargo_count = int(input())
  2. total_cargo = 0
  3. total_price = 0
  4. bus = 0
  5. truck = 0
  6. train = 0
  7. for i in range(cargo_count):
  8.   cargo_weight = int(input())
  9.   total_cargo += cargo_weight
  10.   if cargo_weight <= 3:
  11.     total_price += cargo_weight * 200
  12.     bus += cargo_weight
  13.   elif 4 <= cargo_weight <= 11:
  14.     total_price += cargo_weight * 175
  15.     truck += cargo_weight
  16.   elif cargo_weight >= 12:
  17.     total_price += cargo_weight * 120
  18.     train += cargo_weight
  19.    
  20. print(f"{(total_price / total_cargo):.2f}")
  21. print(f"{(bus / total_cargo * 100):.2f}%")
  22. print(f"{(truck / total_cargo * 100):.2f}%")
  23. print(f"{(train / total_cargo * 100):.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment