Yesterday, at the ZOJ Monthly, there is a problem named Diagonal. Let us review that problem:
There is a N * N grids. Each grid should be filled with a number from 1, 2, .., N * N. No two girds share the same number...
But today, we have a new task, we should minimize the maximum sum of the any adjacent girds.
There are some test cases.
For each test case:There is a N (2<=N<=200).
Output the answer for the above problem.
The optimal to fill the gird is:
the max sum of adjacent grid is 4+2=6
If you fill the grid:
the max sum of adjacent grid is 4+3=7
so the answer is 6.