Advertisement
BbJLeB

03. Logistics

May 30th, 2019
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. # 03. Logistics
  2.  
  3. cargo = int(input())
  4. ton_van = 0
  5. ton_tir = 0
  6. ton_train = 0
  7. all_tons = 0
  8.  
  9. for i in range(1, cargo + 1):
  10.     ton = int(input())
  11.     if ton <= 3:
  12.         ton_van += ton
  13.         all_tons += ton
  14.     elif ton >= 4 and ton <= 11:
  15.         ton_tir += ton
  16.         all_tons += ton
  17.     elif ton >= 12:
  18.         ton_train += ton
  19.         all_tons += ton
  20. price_van = ton_van * 200
  21. price_tir = ton_tir * 175
  22. price_train = ton_train * 120
  23. procent_ton = (price_tir + price_train + price_van) / all_tons
  24. procent_van = (ton_van / all_tons) * 100
  25. procent_tir = (ton_tir / all_tons) * 100
  26. procent_train = (ton_train / all_tons) * 100
  27. print(f"{procent_ton:.2f}")
  28. print(f"{procent_van:.2f}%")
  29. print(f"{procent_tir:.2f}%")
  30. print(f"{procent_train:.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement