Advertisement
bl00dt3ars

02. The Lift

Jun 29th, 2021
467
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. people = int(input())
  2. wagons = [int(el) for el in input().split()]
  3.  
  4. while people > 0 and sum(wagons) < len(wagons) * 4:
  5.     people -= 1
  6.     for i in range(len(wagons)):
  7.         if wagons[i] < 4:
  8.             wagons[i] += 1
  9.             break
  10.  
  11. if sum(wagons) < len(wagons) * 4:
  12.     print("The lift has empty spots!")
  13. elif people > 0:
  14.     print(f"There isn't enough space! {people} people in a queue!")
  15. print(*wagons)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement