HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC17 Prep Contest > problem:


2. 51098 - Rotate a matrix

IMPC17 Prep Contest

Start: Apr.22.2017 at 02:00:00 PM
Finish: Apr.22.2017 at 07:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• 1. 51099 - Mr. Monk
• 2. 51098 - Rotate a matrix
• 3. 51097 - Sum of Borders
• 4. 51100 - Minimum time to exit buil...
• 5. 50621 - Postal Figures

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