sibinasto

05. (28 March 2020) Suitcases Load

Dec 6th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.60 KB | None | 0 0
  1. plane_capacity = float(input())
  2. no_more_place = False
  3. iterations_counter = 0
  4. command = input()
  5. while command != "End":
  6.     suitcase_volume = float(command)
  7.     iterations_counter += 1
  8.     if iterations_counter % 3 == 0:
  9.         suitcase_volume *= 1.1
  10.     if plane_capacity - suitcase_volume < 0:
  11.         iterations_counter -= 1
  12.         no_more_place = True
  13.         break
  14.     plane_capacity -= suitcase_volume
  15.     command = input()
  16. if no_more_place:
  17.     print("No more space!")
  18. else:
  19.     print("Congratulations! All suitcases are loaded!")
  20. print(f"Statistic: {iterations_counter} suitcases loaded.")
Advertisement
Add Comment
Please, Sign In to add comment