Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- people = int(input())
- wagons = list(map(int, input().split()))
- for lift in range(len(wagons)):
- if people < 4 and wagons[lift] < 4:
- wagons[lift] += people
- if wagons[lift] > 4:
- waiting = wagons[lift] - 4
- wagons[lift] -= waiting
- people += waiting
- break
- wagons[lift] += 4
- people -= 4
- if wagons[lift] > 4:
- waiting = wagons[lift] - 4
- wagons[lift] -= waiting
- people += waiting
- available_space = False
- for w in wagons:
- if int(w) < 4:
- available_space = True
- break
- if available_space:
- print('The lift has empty spots!')
- elif people > 0 and wagons[-1] == 4:
- print(f"There isn't enough space! {people} people in a queue!")
- for el in wagons:
- print(el, end=' ')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement