Advertisement
viligen

key_revolver

Jan 15th, 2022
1,054
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. from collections import deque
  2.  
  3. bullet_price = int(input())
  4. gun_barrel = int(input())
  5. bullets_stack = [int(s) for s in input().split()]
  6. locks_que = deque(int(s) for s in input().split())
  7. intelligence_value = int(input())
  8.  
  9. bullets_shot = 0
  10. load = gun_barrel
  11. while bullets_stack and locks_que:
  12.     current_bullet = bullets_stack.pop()
  13.     bullets_shot += 1
  14.     load -= 1
  15.     if current_bullet <= locks_que[0]:
  16.         locks_que.popleft()
  17.         print("Bang!")
  18.     else:
  19.         print("Ping!")
  20.     if load == 0 and bullets_stack:
  21.         print("Reloading!")
  22.         load = gun_barrel
  23.  
  24. if not locks_que:
  25.     print(f"{len(bullets_stack)} bullets left. Earned ${intelligence_value - (bullet_price * bullets_shot)}")
  26.  
  27. else:
  28.     print(f"Couldn't get through. Locks left: {len(locks_que)}")
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement