P5731 [Shenji 5. Exercise 6] Spiral Matrix
Description
Given a positive integer $n$ not greater than $9$, output an $n \times n$ spiral matrix.
Start by filling $1$ in the top-left corner, then fill the numbers in clockwise order, as shown in the sample. Note that each number takes up $3$ characters, padded with leading spaces.
Input Format
Input one positive integer $n$, with the meaning described above.
Output Format
Output the spiral matrix that meets the requirements.
Explanation/Hint
Constraints: $1 \leq n \leq 9$.
Translated by ChatGPT 5