-->
当前位置:首页 > 题库

PROGRAMMING:Another round trip square

Luz5年前 (2021-05-10)题库467
The so-called "round-trip square matrix" means that for any given n, 1 to n × The integers of N are filled in to N in turn × In the square matrix of N, start from the first lattice in the lower right corner and fill upward; After reaching the top row, the left column changes direction and fills down; After pouring the bottom, move one column to the left, change the direction, and fill up And so on, until n × The square matrix of n is filled. This problem requires the construction of such a "round-trip running matrix".
###Input format:
Enter a positive integer n (1 ⩽ n ⩽ 10)
###Output format:
Output n × The round-trip matrix of n. There are n numbers in each row, and each number occupies 3 digits, right aligned.
###Input sample 1:
Here is a set of inputs. For example:
```in
three
```
###Output sample 1:
The corresponding output is given here. For example:
```out
9 4 3
8 5 2
7 6 1
```
###Input sample 2:
Here is a set of inputs. For example:
```in
five
```
###Output sample 2:
The corresponding output is given here. For example:
```out
25 16 15 6 5
24 17 14 7 4
23 18 13 8 3
22 19 12 9 2
21 20 11 10 1
```






answer:If there is no answer, please comment