Feb 14th, 2021
52
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. from collections import deque
2.
3. f_effects = deque([int(el) for el in input().split(", ")])
4. e_power = [int(el) for el in input().split(", ")]
5.
6. counter_palm = 0
7. counter_willow = 0
8. counter_crossette = 0
9.
10. perfect_firework = False
11.
12. while len(f_effects) !=0 and len(e_power) != 0:
13.     if e_power[-1] >= 0 and f_effects[0] >= 0:
14.         current_value = f_effects[0] + e_power[-1]
15.     else:
16.         if e_power[-1] <= 0:
17.             e_power.pop()
18.         else:
19.             f_effects.pop()
20.
21.         continue
22.
23.     if f_effects[0] <= 0 and e_power[-1] <= 0:
24.         f_effects.popleft()
25.         e_power.pop()
26.
27.     if current_value % 3 == 0 and current_value % 5 == 0:
28.         counter_crossette += 1
29.         f_effects.popleft()
30.         e_power.pop()
31.     elif current_value % 3 == 0:
32.         counter_palm += 1
33.         f_effects.popleft()
34.         e_power.pop()
35.     elif current_value % 5 == 0:
36.         counter_willow += 1
37.         f_effects.popleft()
38.         e_power.pop()
39.     else:
40.         f_effects[0] -= 1
41.         element = f_effects.popleft()
42.         f_effects.append(element)
43.     if counter_crossette >= 3 and counter_palm >= 3 and counter_willow >= 3:
44.         perfect_firework = True
45.         break
46. if perfect_firework:
47.     print("Congrats! You made the perfect firework show!")
48. else:
49.     print("Sorry. You can’t make the perfect firework show.")
50.
51.
52. if len(f_effects) > 0:
53.     print(f"Firework Effects left: {', '.join([str(el) for el in f_effects])}")
54. if len(e_power) > 0:
55.     print(f"Explosive Power left: {', '.join([str(el) for el in e_power])}")
56. print(f"Palm Fireworks: {counter_palm}")
57. print(f"Willow Fireworks: {counter_willow}")
58. print(f"Crossette Fireworks: {counter_crossette}")
RAW Paste Data