#P5731. 【深基5.习6】蛇形方阵
【深基5.习6】蛇形方阵
Description
Given a positive integer not greater than , output an spiral matrix.
Start by filling in the top-left corner, then fill the numbers in clockwise order, as shown in the sample. Note that each number takes up characters, padded with leading spaces.
Input Format
Input one positive integer , with the meaning described above.
Output Format
Output the spiral matrix that meets the requirements.
4
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
Hint
Constraints: .
Translated by ChatGPT 5
京公网安备 11011102002149号