結果

問題 No.2432 Flip and Move
ユーザー tassei903tassei903
提出日時 2023-08-11 22:31:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 400 ms / 2,000 ms
コード長 460 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 163,584 KB
最終ジャッジ日時 2024-05-06 02:09:28
合計ジャッジ時間 7,442 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,480 KB
testcase_01 AC 38 ms
52,096 KB
testcase_02 AC 87 ms
70,656 KB
testcase_03 AC 400 ms
163,584 KB
testcase_04 AC 67 ms
71,680 KB
testcase_05 AC 69 ms
71,680 KB
testcase_06 AC 67 ms
67,584 KB
testcase_07 AC 296 ms
132,864 KB
testcase_08 AC 280 ms
135,552 KB
testcase_09 AC 382 ms
160,512 KB
testcase_10 AC 72 ms
66,944 KB
testcase_11 AC 82 ms
67,968 KB
testcase_12 AC 73 ms
66,048 KB
testcase_13 AC 77 ms
69,504 KB
testcase_14 AC 153 ms
96,000 KB
testcase_15 AC 295 ms
143,488 KB
testcase_16 AC 84 ms
68,992 KB
testcase_17 AC 128 ms
83,200 KB
testcase_18 AC 72 ms
73,728 KB
testcase_19 AC 122 ms
82,560 KB
testcase_20 AC 102 ms
84,992 KB
testcase_21 AC 127 ms
81,536 KB
testcase_22 AC 62 ms
68,096 KB
testcase_23 AC 92 ms
78,720 KB
testcase_24 AC 107 ms
83,200 KB
testcase_25 AC 116 ms
81,536 KB
testcase_26 AC 107 ms
83,200 KB
testcase_27 AC 46 ms
60,672 KB
testcase_28 AC 55 ms
64,128 KB
testcase_29 AC 105 ms
72,704 KB
testcase_30 AC 123 ms
83,712 KB
testcase_31 AC 78 ms
71,040 KB
testcase_32 AC 55 ms
63,488 KB
testcase_33 AC 145 ms
83,584 KB
testcase_34 AC 70 ms
67,584 KB
testcase_35 AC 77 ms
74,112 KB
testcase_36 AC 35 ms
52,224 KB
testcase_37 AC 35 ms
51,968 KB
testcase_38 AC 36 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
from math import gcd
l = h * w // gcd(h,w) * 2
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