結果

問題 No.82 市松模様
ユーザー turner18_jpturner18_jp
提出日時 2017-12-08 19:33:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 541 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 7,924 KB
最終ジャッジ日時 2023-08-19 22:38:09
合計ジャッジ時間 1,220 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,848 KB
testcase_01 AC 16 ms
7,868 KB
testcase_02 AC 16 ms
7,864 KB
testcase_03 AC 16 ms
7,912 KB
testcase_04 AC 16 ms
7,792 KB
testcase_05 AC 16 ms
7,856 KB
testcase_06 AC 16 ms
7,772 KB
testcase_07 AC 16 ms
7,924 KB
testcase_08 AC 16 ms
7,868 KB
testcase_09 AC 18 ms
7,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

w, h, c = input().split()
w = int(w)
h = int(h)
s = ""
re_s = ""

if c == "W":
  for i in range(w):
    if i % 2 == 0:
      s = s + "W"
    else:
      s = s + "B"
else:
  for i in range(w):
    if i % 2 == 0:
      s = s + "B"
    else:
      s = s + "W"

if not w % 2 == 0:
  for i in s:
    if i == "W":
      re_s = re_s + "B"
    else:
      re_s = re_s + "W"

  for i in range(h):
    if i % 2 == 0:
      print(s)
    else:
      print(re_s)
else:
  for i in range(h):
    if i % 2 == 0:
      print(s)
    else:
      print(s[::-1])
0