Consider an matrix of natural numbers. Here, we say that two numbers and of the matrix are neighbours if they are horizontally, vertically or diagonally adjacent. You have to add a number chosen among to each number of the matrix. As a result, for every pair of neighbours and of the new matrix, cannot be a multiple of four.
Input consists of several cases, each one with and , both between 1 and 100, followed by lines, each one with integer numbers between 0 and .
For every given matrix, print your resulting matrix. If there is more than one solution, print any of them. Print a line with 20 dashes after every matrix.
Author: Salvador Roura
Generation: 2026-01-25T12:01:40.883Z
© Jutge.org, 2006–2026.
https://jutge.org