#1034. 【入门4】蛇形方阵

【入门4】蛇形方阵

说明

给出一个不大于 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>9</mn></mrow></semantics></math>9 的正整数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>n,输出 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi><mo>×</mo><mi>�</mi></mrow></semantics></math>n×n 的蛇形方阵。

从左上角填上 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow></semantics></math>1 开始,顺时针方向依次填入数字,如同样例所示。注意每个数字有都会占用 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>3</mn></mrow></semantics></math>3 个字符,前面使用空格补齐。

输入格式

输入一个正整数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>�</mi></mrow></semantics></math>n,含义如题所述

输出格式

输出符合题目要求的蛇形矩阵

样例

4
  1  2  3  4
 12 13 14  5
 11 16 15  6
 10  9  8  7

提示

数据范围:

数据保证,

<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>≤</mo><mi>�</mi><mo>≤</mo><mn>9</mn></mrow></semantics></math>1n9