Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import deque
- fireworks_effect = deque()
- for el in input().split(", "):
- if int(el) > 0:
- fireworks_effect.append(int(el))
- explosive_power = [int(el) for el in input().split(", ") if int(el) > 0]
- palm_firework = 0
- willow_firework = 0
- crossette_firework = 0
- while fireworks_effect and explosive_power:
- first_effect = fireworks_effect.popleft()
- last_explosive_power = explosive_power.pop()
- effect_sum = first_effect + last_explosive_power
- if effect_sum % 3 == 0 and effect_sum % 5 != 0:
- palm_firework += 1
- elif effect_sum % 5 == 0 and effect_sum % 3 != 0:
- willow_firework += 1
- elif effect_sum % 3 == 0 and effect_sum % 5 == 0:
- crossette_firework += 1
- else:
- first_effect -= 1
- fireworks_effect.append(first_effect)
- explosive_power.append(last_explosive_power)
- if palm_firework >= 3 and willow_firework >= 3 and crossette_firework >= 3:
- print("Congrats! You made the perfect firework show!")
- print(f"Palm Fireworks: {palm_firework}")
- print(f"Willow Fireworks: {willow_firework}")
- print(f"Crossette Fireworks: {crossette_firework}")
- break
- if palm_firework < 3 or willow_firework < 3 or crossette_firework < 3:
- print("Sorry. You can't make the perfect firework show.")
- print(f"Explosive Power left: {', '.join([str(el) for el in explosive_power])}")
- print(f"Palm Fireworks: {palm_firework}")
- print(f"Willow Fireworks: {willow_firework}")
- print(f"Crossette Fireworks: {crossette_firework}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement