結果

問題 No.565 回転拡大
ユーザー htkb
提出日時 2017-09-08 22:59:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 584 bytes
コンパイル時間 200 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-07 06:37:07
合計ジャッジ時間 2,219 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 13 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

R, K = map(int, input().split())
H, W = map(int, input().split())
AH, AW = (H*K, W*K) if R == 0 or R == 180 else (W*K, H*K)
x_dir = 1 if R == 0 or R == 270 else -1
y_dir = 1 if R == 0 or R == 90 else -1

a = [tuple(input()) for _ in [0]*H]
ans = [[0]*AW for _ in [0]*AH]

for _y in range(H*K):
    y = _y//K
    for _x in range(W*K):
        x = _x//K
        if R == 0 or R == 180:
            ans[_y*y_dir-(y_dir==-1)][_x*x_dir-(x_dir==-1)] = a[y][x]
        else:
            ans[_x*x_dir-(x_dir==-1)][_y*y_dir-(y_dir==-1)] = a[y][x]

for i in range(AH):
    print("".join(ans[i]))
0