A magic square of order N is an N × N grid that contains every integer from 1 to N² exactly once, arranged so that every row, every column and both main diagonals add up to the same number.
For odd N there is a simple way to build one. Number the rows 0 to N−1 from top to bottom and the columns 0 to N−1 from left to right, and place the numbers 1, 2, …, N² one at a time:
For example, N = 3 gives
Given N, print the common sum and the magic square built by exactly these steps. The method only works for odd N, so for an even N print a message instead.
Several lines, each with one integer N (1 ≤ N ≤ 20), until end of file. There are at most 50 lines.
For each N, if N is even print the single line It is not an odd number.
Otherwise print the common sum on one line, then the N rows of the square, with the numbers in a row separated by one space.
Print one blank line between the outputs of two consecutive values of N, and no blank line after the last one.
範例輸入 1
3 4 5
範例輸出 1
15 6 1 8 7 5 3 2 9 4 It is not an odd number. 65 15 8 1 24 17 16 14 7 5 23 22 20 13 6 4 3 21 19 12 10 9 2 25 18 11
Pro 專屬功能: 查看這題在歷屆 CPE 出現過幾次 — 升級以解鎖.