Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- energy = deque(int(x) for x in input().split())
- materials = [int(x) for x in input().split()]
- toys = 0
- counter = 0
- while energy or materials:
- current_energy = energy.popleft()
- current_materials = materials.pop()
- if current_energy >= current_materials:
- counter += 1
- if counter % 3 == 0:
- if current_energy >= current_materials * 2
- toys += 2
- current_energy = current_energy + 1
- current_energy -= current_materials
- energy.append(current_energy)
- elif counter % 5 == 0:
- pass
- else:
- toys += 1
- current_energy = current_energy + 1
- current_energy -= current_materials
- energy.append(current_energy)
- print(counter)
- else:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement