Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- cups_ques = deque(int(s) for s in input().split())
- bottles_stack = [int(s) for s in input().split()]
- wasted_water = 0
- while cups_ques and bottles_stack:
- current_bottle = bottles_stack.pop()
- if current_bottle >= cups_ques[0]:
- wasted_water += current_bottle - cups_ques.popleft()
- else:
- cups_ques[0] -= current_bottle
- if not cups_ques:
- print("Bottles:", *reversed(bottles_stack))
- else:
- print("Cups:", *cups_ques)
- print(f"Wasted litters of water: {wasted_water}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement