There is a table and cards printed with the numbers , , , , , , , , . How many ways are there for these cards to be distributed to the cells of the table so that there is one card in each cell, and that the sum of the numbers of the three cards on each row, each column and each of the two diagonals of the table is nonnegative?
Solution
Answer:
We first make a few observations.
* The sum of the numbers on all cards is . Hence each row sum being nonnegative is equivalent to each row sum being .
* For the same reason as above, each column sum must be .
* The card cannot be placed in a corner cell. Indeed, if is placed in a corner cell as shown below, then the sum of the other two numbers in the first row is , the sum of the other two numbers in the first column is and the sum of the other two numbers in the diagonal containing is at least . This is impossible since the sum of the positive numbers on the cards is only .

* In essentially the same way we can prove that the card cannot be placed in the central cell.
From the above observations, there are choices for the position of . After the position of is fixed as shown below, there are choices for the other two numbers in the first row (we either put in or in either order), and then choices for the other two numbers in the second column (we put in the remaining pair in either order).
ways to fill in five cells. There is then only one way to fill in the remaining cells using the numbers , , and . For instance, suppose we have filled the cells in the following way, with , , , denoting the numbers yet to be filled in:
<table><tr><td>1</td><td>-4</td><td>3</td></tr><tr><td>a</td><td>0</td><td>b</td></tr><tr><td>c</td><td>4</td><td>d</td></tr></table>
By considering the rows, we need and , so and . By considering the columns, we need and . Hence the only possibility is . It remains to check whether these ways also satisfy the requirement that the two diagonal sums are nonnegative. We start with the following cases with the position of fixed:
<table><tr><td>1</td><td>-4</td><td>3</td></tr><tr><td>2</td><td>0</td><td>-2</td></tr><tr><td>-3</td><td>4</td><td>-1</td></tr></table>
<table><tr><td>1</td><td>-4</td><td>3</td></tr><tr><td>-3</td><td>4</td><td>-1</td></tr><tr><td>2</td><td>0</td><td>-2</td></tr></table>
<table><tr><td>0</td><td>-4</td><td>4</td></tr><tr><td>2</td><td>1</td><td>-3</td></tr><tr><td>-2</td><td>3</td><td>-1</td></tr></table>
<table><tr><td>0</td><td>-4</td><td>4</td></tr><tr><td>-2</td><td>3</td><td>-1</td></tr><tr><td>2</td><td>1</td><td>-3</td></tr></table>
All cases have both diagonal sums being nonnegative. The other cases with in the same position must therefore also have the same property, since they are obtained by swapping the first and third columns from the cases above:
<table><tr><td>3</td><td>-4</td><td>1</td></tr><tr><td>-2</td><td>0</td><td>2</td></tr><tr><td>-1</td><td>4</td><td>-3</td></tr></table>
<table><tr><td>3</td><td>-4</td><td>1</td></tr><tr><td>-1</td><td>4</td><td>-3</td></tr><tr><td>-2</td><td>0</td><td>2</td></tr></table>
<table><tr><td>4</td><td>-4</td><td>0</td></tr><tr><td>-3</td><td>1</td><td>2</td></tr><tr><td>-1</td><td>3</td><td>-2</td></tr></table>
<table><tr><td>4</td><td>-4</td><td>0</td></tr><tr><td>-1</td><td>3</td><td>-2</td></tr><tr><td>-3</td><td>1</td><td>2</td></tr></table>
The other cases (where the position of is different) can be obtained by rotating one of the above configurations. Hence all ways of filling in the table in which all row and column sums are zero will also have both diagonal sums being nonnegative. It follows that the answer is .