A spiral walk
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

Oh how the cows love to walk in their square pasture with sides of length N (1 <= N <= 750) and which is partitioned into N*N squares. They enjoy the sights, the smells, and the general ambience of the grass and trees.
Bessie has decided to take the cows on the longest possible walk from the upper left corner to the center (or near the center when N is even) of the pasture, passing through each and every square along the way after starting.
She has decided to create the obvious clockwise spiral route (example below) for this evening's stroll. Write a program to create a map for her that shows the order of squares she should visit.
By way of example, for pastures of size N=3 and N=4, here are the
routes Bessie should use:
      1  2  3        1  2  3  4
      8  9  4       12 13 14  5
      7  6  5       11 16 15  6
                    10  9  8  7

输入描述:

* Line 1: A single integer: N

输出描述:

* Lines 1..N: N space-separated integers
示例1

输入

复制
3

输出

复制
1 2 3
8 9 4
7 6 5