Advertisement
ilnurav

Untitled

Mar 31st, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. mat =[list(input()) for _ in range(8)]
  2. for i in range(8):
  3. for j in range(8):
  4. if mat[i][j] == 'R' or mat[i][j] == 'B':
  5. x0 = i
  6. y0 = j
  7. for x in range(8):
  8. for y in range(8):
  9. if abs(x - x0) == abs(y - y0) and mat[i][j] == 'B' and mat[x][y] != 'R' and mat[x][y] != 'B' and mat[x][y] != '.':
  10. mat[x][y] = '.'
  11. if (x == x0 or y == y0) and mat[i][j] == 'R' and mat[x][y] != 'R' and mat[x][y] != 'B' and mat[x][y] != '.':
  12. mat[x][y] = '.'
  13. k = 0
  14. for i in range(8):
  15. for j in range(8):
  16. # print(mat[i][j], end=' ')
  17. if mat[i][j] == '*':
  18. k += 1
  19. # print()
  20. print(k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement