結果

問題 No.82 市松模様
ユーザー apierceapierce
提出日時 2022-11-03 17:53:23
言語 Ruby
(3.3.0)
結果
AC  
実行時間 85 ms / 5,000 ms
コード長 247 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 11,316 KB
実行使用メモリ 15,288 KB
最終ジャッジ日時 2023-09-25 02:08:32
合計ジャッジ時間 1,799 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,228 KB
testcase_01 AC 84 ms
15,244 KB
testcase_02 AC 84 ms
15,288 KB
testcase_03 AC 85 ms
15,184 KB
testcase_04 AC 81 ms
15,140 KB
testcase_05 AC 81 ms
15,136 KB
testcase_06 AC 82 ms
15,040 KB
testcase_07 AC 82 ms
15,192 KB
testcase_08 AC 80 ms
15,064 KB
testcase_09 AC 82 ms
15,120 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:7: warning: `/' after local variable or literal is interpreted as binary operator
Main.rb:7: warning: even though it seems like regexp literal
Syntax OK

ソースコード

diff #

w, h, c = gets.split
w = w.to_i
h = h.to_i

d = "BW".tr(c, "")
e = c + d
l1 = w.even? ? e * (w / 2) : e * (w /2) + c
l2 = l1[1..] + l1[-1].tr("BW", "WB")

a, b = h.divmod(2)
a.times do |i|
    puts l1
    puts l2
end
b.times do |j|
    puts l1
end
0