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

PROGRAMMING:Rotation matrix

Luz5年前 (2021-05-10)题库380
A matrix of $$n * n $.
You need to rotate the matrix clockwise by $$90$$ ° , A total of $$M $$rotations.
Please output the matrix of $$n * n $$after the rotation of $$M $$.
###Input format:
Multiple sets of input.
For each group of inputs,
Enter an integer $$n $$and a positive integer $$M $$.
When the $$n = 0 $, it means the end of the input.
Next, there are $$n $$rows, each with $$n $$positive integers.
###Output format:
For each group of inputs,
Please output a total of $$n $$lines,
There are $$n $$positive integers in each line, each number is separated by a space, and there is no space at the end of the line.
Represents the rotated matrix.
###Input example:
```in
3 1
1 2 3
4 5 6
7 8 9
2 2
1 2
3 4
0
```
###Output example:
```out
7 4 1
8 5 2
9 6 3
4 3
2 1
```
###Tips and instructions
For each number in the matrix $$num $$,
$$1 <= num <= 1000$$
$$0 <= n <= 100 , 1 <= m <= 1e9$$






answer:If there is no answer, please comment