There is a task:
On the chessboard of N x N dimension there are pawns and a knight. Determine the number of pawns that are under the knight’s battle with a given arrangement of pieces. Pawns in the array are marked as 1, knight - 2, free cell - 0.
Sample input:
5 1 0 0 0 0 0 0 0 1 0 0 2 0 0 1 0 0 0 1 0 1 0 1 0 0 Sample output:
5 The question has nothing to do with the code, please help understand how this can be done. Hint who has suggestions, please. As I understand it, after initialization, you need to view the coordinates of the current cell and compare it with the previously created array of broken cells. How then to fill it? Confusion in the head. Can take the coordinate of each horse and compare it eight times with the "bat" coordinate?