HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


51098 - Rotate a matrix

Guest
• Review clarifications (1)

Section problems

• 50933 - Sum of the Biggest Neighbors
• 50444 - n digit kth number divisible...
• 50865 - Apartment Building Adminis...
• 50874 - Apartment Building Adminis...
• 51127 - Maze solver
• 51126 - Dr. Fllanxha
• 51021 - Number of Nodes
• 51044 - Number of Trees
• 51098 - Rotate a matrix
• 51061 - The Longest Path
• 51083 - Grades Histogram
• 51084 - Reflect a matrix
• 51011 - Decoding the Path
• 51088 - Number of letters
• 51172 - The biggest Minute
• 51125 - Filling an Array 3
• 51085 - xyx Divisible by k

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Rotate a matrix

Question: For a course, you are required to write a program to rotate a 2D array according to the given degree. Write program that gets a 2D array and a rotation degree, then the program rotates and prints the array.

Input specification: Firstly, you will be given two integers (r and c) size of 2D array. Then, you will be given c integers in the following r lines. On the last line, you will be given an integer, which is a multiple of 90 and less than 100,000; where 1 ≤ (r and c) ≤ 100 and the numbers in the matrix are less 1001.

Output specification: Show rotated matrix.

Sample Input I Sample Input II
5 3
7 9 17
9 14 12
6 11 7
13 15 5
5 7 7
90
5 3
19 8 6
7 13 16
8 4 11
5 20 20
20 5 14
180
Sample Output I Sample Output II
5 13 6 9 7
7 15 11 14 9
7 5 7 12 17
14 5 20
20 20 5
11 4 8
16 13 7
6 8 19



Для отправки решений необходимо выполнить вход.

www.contester.ru