Masala #0084
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.
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.
OUTPUT.TXT chiqish faylida kirishda berilgan matritsani K marotaba soat strelkasiga qarshi burganda hosil bo’lgan matritsani chop eting.
# | 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 |
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 |