Advertisement
viligen

honey

Jan 19th, 2022
716
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from collections import deque
  2.  
  3. bees = deque([int(n) for n in input().split()])
  4.  
  5. nectar_stack = [int(n) for n in input().split()]
  6.  
  7. symbols = deque(input().split())
  8.  
  9. honey = 0
  10.  
  11. while bees and nectar_stack:
  12.     current_nectar = nectar_stack.pop()
  13.     if current_nectar < bees[0]:
  14.         continue
  15.     else:
  16.         math_sign = symbols.popleft()
  17.         current_bee = bees.popleft()
  18.         if math_sign == "+":
  19.             honey += abs(current_nectar + current_bee)
  20.         elif math_sign == "-":
  21.             honey += abs(current_bee - current_nectar)
  22.         elif math_sign == "*":
  23.             honey += abs(current_nectar * current_bee)
  24.         elif math_sign == "/" and current_nectar > 0:
  25.             honey += abs(current_bee / current_nectar)
  26.  
  27. print(f"Total honey made: {honey}")
  28. if bees:
  29.     print(f"Bees left: {', '.join(str(n) for n in bees)}")
  30.  
  31. if nectar_stack:
  32.     print(f"Nectar left: {', '.join(str(n) for n in nectar_stack)}")
  33.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement