QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 32 MB 満点: 70

#17080. ROT

統計

Damir 喜欢旋转。现在他正在旋转字母表格。他在一张纸上写了一个 $R \times C$ 的表格。他还选择了一个角度 $K$($45$ 的倍数),并希望将他的表格顺时针旋转这么多度。

事实证明,这个任务对 Damir 来说有点太难了,所以请帮帮他。

输入格式

第一行包含两个由空格隔开的整数 $R$ 和 $C$($1 \le R \le 10$,$1 \le C \le 10$),表示 Damir 表格的行数和列数。

接下来的 $R$ 行,每行包含 Damir 表格的一行,即一个长度为 $C$ 的小写字母字符串。

最后一行包含一个整数 $K$,表示旋转角度,它是 $45$ 的倍数,且在 $0$ 到 $360$ 之间(含 $0$ 和 $360$)。

输出格式

输出顺时针旋转 $K$ 度后的 Damir 表格,如样例所示。输出应包含所需的最少行数。某些行可能包含前导空格,但任何行都不能包含尾随空格。

样例

输入样例 1

3 5
damir
marko
darko
45

输出样例 1

  d
 m a
d a m
 a r i
  r k r
   k o
    o

输入样例 2

3 5
damir
marko
darko
90

输出样例 2

dmd
aaa
rrm
kki
oor

输入样例 3

5 5
abcde
bcdef
cdefg
defgh
efghi
315

输出样例 3

    e
   d f
  c e g
 b d f h
a c e g i
 b d f h
  c e g
   d f
    e

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.