Advertisement
horozov86

Christmas Elves

Jun 12th, 2023
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. from collections import deque
  2.  
  3. energy = deque(int(x) for x in input().split())
  4. materials = [int(x) for x in input().split()]
  5. toys = 0
  6. counter = 0
  7.  
  8. while energy or materials:
  9.    
  10.     current_energy = energy.popleft()
  11.     current_materials = materials.pop()
  12.    
  13.     if current_energy >= current_materials:
  14.         counter += 1
  15.         if counter % 3 == 0:
  16.             if current_energy >= current_materials * 2
  17.             toys += 2
  18.             current_energy = current_energy + 1
  19.             current_energy -= current_materials
  20.             energy.append(current_energy)
  21.            
  22.        
  23.         elif counter % 5 == 0:
  24.             pass
  25.        
  26.         else:
  27.             toys += 1
  28.             current_energy = current_energy + 1
  29.             current_energy -= current_materials
  30.             energy.append(current_energy)
  31.        
  32.            
  33.        
  34.         print(counter)
  35.    
  36.     else:
  37.         pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement