Advertisement
Spocoman

02. The Lift

Nov 4th, 2023
1,241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. people = int(input())
  2. wagons = list(map(int, input().split(' ')))
  3.  
  4. for i in range(len(wagons)):
  5.     for j in range(wagons[i], 4):
  6.         if people == 0:
  7.             break
  8.         wagons[i] += 1
  9.         people -= 1
  10.        
  11. if wagons[-1] < 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.  
  16. print(*wagons, sep=' ')
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement