1. In each cell of an $n \times n$ table, an integer is written. It turns out that for all $k$ from 1 to $n$, the sum of the numbers in the $k$-th column is either one less or two more than the sum of the numbers in the $k$-th row. For which $n$ is this possible?
Answer: for $n$ divisible by three

Solution. Let the number of rows, the sum of the numbers in which is one less than in the columns with the same number, be $m$. Then the number of rows, the sum of the numbers in which is two more than in the columns with the same number, is $n-m$. Therefore, the sum of all numbers, counted by rows, differs from the sum of the numbers, counted by columns, by $2(n-m)-m$. Thus, $2n=3m$ and, therefore, $n$ is divisible by three.

We will provide an example of the required arrangement for $n$ divisible by three. For $k$ from 1 to $n / 3$, place ones in the cells at the intersection of rows with numbers $2k-1$ and $2k$ and the column with number $n-k+1$, and fill the remaining cells with zeros. The described arrangement of numbers for $n=9$ is shown in the figure, with zeros in the empty cells.

![](https://cdn.mathpix.com/cropped/2024_05_06_e0197926f6acc0f95da5g-19.jpg?height=414&width=434&top_left_y=958&top_left_x=183)