#C2156. Spiral Grid Generator
Spiral Grid Generator
Spiral Grid Generator
You are given a positive integer . Your task is to generate an grid filled with numbers from to in spiral order. The spiral starts from the top-left corner and moves to the right, then downward, then to the left, and upward, repeating the sequence until the entire grid is filled. The problem requires you to read the input from stdin and output the grid to stdout. Each row of the grid should be output on a new line with values separated by a single space.
inputFormat
The input consists of a single integer () provided via stdin. This integer represents the dimensions of the square grid.
outputFormat
Print the spiral grid, where each row is printed on a separate line, and each integer in a row is separated by a space. There should be no extra spaces at the end of the lines.## sample
1
1