Advertisement
ilnurav

Untitled

Apr 2nd, 2020
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 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 mat[i][j] == 'R' and mat[x][y] == 'B':
  10. break
  11. 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] != '.':
  12. mat[x][y] = '.'
  13. 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] != '.':
  14. mat[x][y] = '.'
  15. k = 0
  16. for i in range(8):
  17. for j in range(8):
  18. # print(mat[i][j], end=' ')
  19. if mat[i][j] == '*':
  20. k += 1
  21. # print()
  22. print(k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement