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

PROGRAMMING:Rearrangement matrix

Luz5年前 (2021-05-10)题库426
Given a set of inputs, it is required to arrange them in the form of a matrix according to specific rules. We need to arrange them in non ascending order, first the outer layer, then the inner layer, clockwise. In order to make the matrix look better, we want the matrix to be as square as possible. If the matrix is m rows and N columns, then M is not less than N, and the difference between M and N is the smallest.
###Input format:
First, input a positive integer n, the number of data to be rearranged, and then give n data in turn, N and data are not more than the fourth power of 10.
###Output format:
For each group of input, the output rearranged matrix requires a space between each number.
###Input example:
Here is a set of inputs. For example:
```in
fifteen
1 2 3 4 9 8 7 6 10 15 12 20 40 1 17
```
###Output example:
The corresponding output is given here. For example:
```out
40 20 17
3 2 15
4 1 12
6 1 10
7 8 9
```







answer:If there is no answer, please comment