Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from _collections import deque
- materials = [int(x) for x in input().split()]
- magic_level = deque([int(x) for x in input().split()])
- presents = {}
- while materials and magic_level:
- box = materials.pop()
- magic = magic_level.popleft()
- total_magic_level = box * magic
- if total_magic_level == 150:
- if "Doll" not in presents:
- presents["Doll"] = 0
- presents["Doll"] += 1
- elif total_magic_level == 250:
- if "Wooden train" not in presents:
- presents["Wooden train"] = 0
- presents["Wooden train"] += 1
- elif total_magic_level == 300:
- if "Teddy bear" not in presents:
- presents["Teddy bear"] = 0
- presents["Teddy bear"] += 1
- elif total_magic_level == 400:
- if "Bicycle" not in presents:
- presents["Bicycle"] = 0
- presents["Bicycle"] += 1
- else:
- if total_magic_level < 0:
- result = box + magic
- materials.append(result)
- if total_magic_level > 0 and total_magic_level != 150 and total_magic_level != 250 and total_magic_level != 300 and total_magic_level != 400:
- box += 15
- materials.append(box)
- if box == 0 and magic == 0:
- continue
- if box == 0:
- magic_level.appendleft(magic)
- continue
- if magic == 0:
- materials.append(box)
- continue
- if "Doll" and "Wooden train" in presents or "Teddy bear" and "Bicycle" in presents:
- print("The presents are crafted! Merry Christmas!")
- else:
- print("No presents this Christmas!")
- if materials:
- materials_left = ', '.join([str(x) for x in reversed(materials)])
- print(f"Materials left: {materials_left}")
- if magic_level:
- print(f"Magic left: {', '.join([str(x) for x in magic_level])}")
- for k, v in presents.items():
- print(f"{k}: {v}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement