Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ppl = int(input())
- lift_state = list(map(int, input().split()))
- max_capacity = 4
- out_list = []
- while ppl > 0 and len(out_list) < len(lift_state):
- for wagon in lift_state:
- free_space = max_capacity - wagon
- if 0 < free_space <= ppl:
- wagon = max_capacity
- ppl -= free_space
- elif ppl < free_space:
- wagon += ppl
- ppl = 0
- out_list.append(wagon)
- if ppl == 0 and len([n for n in out_list if n == max_capacity]) == len(out_list):
- pass
- elif ppl == 0:
- print("The lift has empty spots!")
- elif ppl > 0:
- print(f"There isn't enough space! {ppl} people in a queue!")
- print(*out_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement