Advertisement
pacho_the_python

Untitled

Jan 16th, 2023
937
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.27 KB | None | 0 0
  1. from collections import deque
  2.  
  3.  
  4. materials = deque(map(int, input().split()))
  5. magic_level = deque(map(int, input().split()))
  6.  
  7. diamond = 0
  8. gem = 0
  9. porcelain = 0
  10. gold = 0
  11.  
  12. result = 0
  13.  
  14. while materials and magic_level:
  15.     material = materials.pop()
  16.     magic = magic_level.popleft()
  17.     result = material + magic
  18.  
  19.     if result < 100:
  20.         if result % 2 == 0:
  21.             result = material * 2 + magic * 3
  22.         else:
  23.             result = material * 2 + magic * 2
  24.     elif result > 499:
  25.         result = material / 2 + magic / 2
  26.  
  27.     if 100 <= result <= 199:
  28.         gem += 1
  29.     elif 200 <= result <= 299:
  30.         porcelain += 1
  31.     elif 300 <= result <= 399:
  32.         gold += 1
  33.     elif 400 <= result <= 499:
  34.         diamond += 1
  35.  
  36. if (gem > 0 and porcelain > 0) or (gold > 0 and diamond > 0):
  37.     print("The wedding presents are made!")
  38. else:
  39.     print("Aladdin does not have enough wedding presents.")
  40.  
  41. if materials:
  42.     print(f"Materials left: {', '.join(map(str, materials))}")
  43.  
  44. if magic_level:
  45.     print(f"Magic left: {', '.join(map(str, magic_level))}")
  46.  
  47. if diamond:
  48.     print(f"Diamond Jewellery: {diamond}")
  49. if gem:
  50.     print(f"Gemstone: {gem}")
  51. if gold:
  52.     print(f"Gold: {gold}")
  53. if porcelain:
  54.     print(f"Porcelain Sculpture: {porcelain}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement