Masala #0084

Xotira 16 MB Vaqt 1000 ms
14

Matritsani burish

Sizda N x M o’lchamli matritsa mavjud. Siz bu matritsa elementlarini K marotaba soat strelkasiga qarshi burganingizda qanday matritsa hosil bo’lishini aniqlang!

Quyida 4x5 o’lchamli matritsaning soat strelkasiga qarshi 1 marotaba buralishida har bir elementning qaysi indeksga o’tishi ko’rsatilgan.


Kiruvchi ma'lumotlar:

INPUT.TXT kirish faylining dastlabki satrida uchta butun son, N, M(2 ≤ N, M ≤ 300, min(N,M)%2==0) va K(1 ≤ K ≤ 109) sonlari bo’sh joy bilan ajratilgan holda kiritiladi. Keyingi N ta satrning har birida M tadan [1, 108] oralig’idagi butun son bo’sh joy bilan ajratilgan holda kiritiladi va bu sonlar matritsaning dastlabki holatini ifodalaydi.


Chiquvchi ma'lumotlar:

OUTPUT.TXT chiqish faylida kirishda berilgan matritsani K marotaba soat strelkasiga qarshi burganda hosil bo’lgan matritsani chop eting.


Misollar
# input.txt output.txt
1
4 4 1
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
2 3 4 8
1 7 11 12
5 6 10 16
9 13 14 15
2
4 4 2
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
3 4 8 12
2 11 10 16
1 7 6 15
5 9 13 14
Izoh:

1

2

3

4

2

3

4

8

3

4

8

12

5

6

7

8

1

7

11

12

2

11

10

16

9

10

11

12

5

6

10

16

1

7

6

15

13

14

15

16

9

13

14

15

5

9

13

14