結果

問題 No.2432 Flip and Move
ユーザー tassei903tassei903
提出日時 2023-08-11 22:20:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 542 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 163,456 KB
最終ジャッジ日時 2024-05-06 02:09:43
合計ジャッジ時間 8,748 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,840 KB
testcase_01 AC 40 ms
52,096 KB
testcase_02 AC 130 ms
72,576 KB
testcase_03 AC 542 ms
163,456 KB
testcase_04 AC 85 ms
73,984 KB
testcase_05 AC 76 ms
71,552 KB
testcase_06 AC 89 ms
70,272 KB
testcase_07 AC 357 ms
133,120 KB
testcase_08 AC 349 ms
135,552 KB
testcase_09 AC 476 ms
160,256 KB
testcase_10 AC 104 ms
69,120 KB
testcase_11 AC 89 ms
67,712 KB
testcase_12 AC 101 ms
68,480 KB
testcase_13 AC 84 ms
69,248 KB
testcase_14 AC 187 ms
96,000 KB
testcase_15 AC 395 ms
143,744 KB
testcase_16 AC 93 ms
68,864 KB
testcase_17 AC 218 ms
83,712 KB
testcase_18 AC 108 ms
78,720 KB
testcase_19 AC 196 ms
82,176 KB
testcase_20 AC 176 ms
84,736 KB
testcase_21 AC 154 ms
81,792 KB
testcase_22 AC 128 ms
71,424 KB
testcase_23 AC 104 ms
78,592 KB
testcase_24 AC 198 ms
83,200 KB
testcase_25 AC 175 ms
81,280 KB
testcase_26 AC 141 ms
82,944 KB
testcase_27 AC 59 ms
62,336 KB
testcase_28 AC 61 ms
64,128 KB
testcase_29 AC 126 ms
72,704 KB
testcase_30 AC 145 ms
83,712 KB
testcase_31 AC 94 ms
71,040 KB
testcase_32 AC 63 ms
63,616 KB
testcase_33 AC 165 ms
83,584 KB
testcase_34 AC 79 ms
67,456 KB
testcase_35 AC 86 ms
73,600 KB
testcase_36 AC 40 ms
52,224 KB
testcase_37 AC 40 ms
51,840 KB
testcase_38 AC 41 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
from math import gcd
l = h * w // gcd(h,w) * 4
k = int(input()) % l

x,y = 0,0
dx,dy = 1,1

s = [["." for j in range(w)] for i in range(h)]

for _ in range(k):
    if s[x][y] == ".":
        s[x][y] = "#"
    else:
        s[x][y] = "."

    if x + dx < 0 or x + dx >= h:
        dx *= -1
    else:
        x += dx
    if y + dy < 0 or y + dy >= w:
        dy *= -1
    else:
        y += dy

for i in s:
    print("".join(i))
0