跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F1109. Magic Odd Square

    ID: 1115 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 4 上传者: 标签>构造数学算法思想进阶难度共享题库Codeforces英文题面题目来源题面语言

Magic Odd Square

题目描述

C. Magic Odd Square
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Find an n×n matrix with different numbers from 1 to n2, so the sum in each row, column and both main diagonals are odd.

Input

The only line contains odd integer n (1≤n≤49).

Output

Print n lines with n integers. All the integers should be different and from 1 to n2. The sum in each row, column and both main diagonals should be odd.

Examples
Input
1
Output
1
Input
3
Output
2 1 4
3 5 7
6 9 8


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 576 题。保留原作者与原赛事署名。