Advertisement
bl00dt3ars

04. Battle Ships

May 31st, 2021
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. rows = int(input())
  2. ships = []
  3. counter = 0
  4.  
  5. for i in range(rows):
  6.     current_list = [int(el) for el in input().split()]
  7.     ships.append(current_list)
  8.  
  9. command = [el for el in input().split()]
  10.  
  11. for x in range(len(command)):
  12.     if ships[int(command[x][0])][int(command[x][2])] != 0:
  13.         ships[int(command[x][0])][int(command[x][2])] -= 1
  14.         if ships[int(command[x][0])][int(command[x][2])] == 0:
  15.             counter += 1
  16.  
  17. print(counter)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement