ElenaSokol

keyrevolver

Nov 8th, 2022
1,030
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. from collections import deque
  2.  
  3. price_of_bullet = int(input())
  4. size_of_gun = int(input())
  5. bullets = list(map(int, input().split()))
  6. bullets_size = len(bullets)
  7. locks = deque(map(int, input().split()))
  8. locks_size = len(locks)
  9. value_of_intelligence = int(input())
  10. bullets_num = 0
  11. lock_num = 0
  12.  
  13.  
  14. while True:
  15.  
  16.     if not bullets:
  17.         break
  18.  
  19.     if not locks:
  20.         break
  21.  
  22.     if locks[0] >= bullets[-1]:
  23.         print("Bang!")
  24.         bullets.pop()
  25.         locks.popleft()
  26.         bullets_num += 1
  27.         lock_num += 1
  28.  
  29.     else:
  30.         print("Ping!")
  31.         bullets.pop()
  32.         bullets_num += 1
  33.  
  34.     if bullets_num % size_of_gun == 0 and bullets:
  35.         print("Reloading!")
  36.  
  37. bullets_cost = price_of_bullet * bullets_num
  38. money_earned = value_of_intelligence - bullets_cost
  39. bullets_left = bullets_size - bullets_num
  40. locks_left = locks_size - lock_num
  41.  
  42. if bullets_left >= 0:
  43.     if locks_left <= 0:
  44.         print(f"{bullets_left} bullets left. Earned ${money_earned}")
  45.     else:
  46.         print(f"Couldn't get through. Locks left: {locks_left}")
  47.  
  48.  
Advertisement
Add Comment
Please, Sign In to add comment