D. 【例63.1】 蛇形填数

    Type: Default 1000ms 64MiB

【例63.1】 蛇形填数

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Description

Fill an n×nn \times n matrix with numbers 11, 22, 33, ..., n×nn \times n in a snake-like pattern. For example, when n=4n=4, the matrix looks like:

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

Where $n \le 20$.

Input Format

Input nn.

Output Format

Output the matrix as described. nn lines, with numbers in each line separated by a single space.

Sample

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

20251108C班作业(6)

Not Claimed
Status
Done
Problem
4
Open Since
2025-11-8 0:00
Deadline
2025-11-16 23:59
Extension
24 hour(s)