結果

問題 No.82 市松模様
コンテスト
ユーザー luyaowang-oss
提出日時 2026-11-27 17:33:22
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 16 ms / 5,000 ms
+ 575µs
コード長 1,143 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 54 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2026-11-27 17:33:24
合計ジャッジ時間 2,241 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

W, H, C = map(str , input().split())
W, H = int(W), int(H)
if H%2==0:
    for i in range(0, H//2):
        if C=="B" and W%2==0:
            print("BW"*(W//2))
            print("WB"*(W//2))
        elif C=="B" and W%2!=0:
            print("BW"*(W//2)+"B")
            print("WB"*(W//2)+"W")
        elif C=="W" and W%2==0:
            print("WB"*(W//2))
            print("BW"*(W//2))
        elif C=="W" and W%2!=0:
            print("WB"*(W//2)+"W")
            print("BW"*(W//2)+"B")
else:
    for i in range(0, H//2):
        if C=="B" and W%2==0:
            print("BW"*(W//2))
            print("WB"*(W//2))
        elif C=="B" and W%2!=0:
            print("BW"*(W//2)+"B")
            print("WB"*(W//2)+"W")
        elif C=="W" and W%2==0:
            print("WB"*(W//2))
            print("BW"*(W//2))
        elif C=="W" and W%2!=0:
            print("WB"*(W//2)+"W")
            print("BW"*(W//2)+"B")
    if C=="B" and W%2==0:
        print("BW"*(W//2))
    elif C=="B" and W%2!=0:
        print("BW"*(W//2)+"B")
    elif C=="W" and W%2==0:
        print("WB"*(W//2))
    elif C=="W" and W%2!=0:
        print("WB"*(W//2)+"W")



0