結果

問題 No.82 市松模様
ユーザー simansiman
提出日時 2015-01-10 22:36:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 287 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 11,300 KB
実行使用メモリ 15,288 KB
最終ジャッジ日時 2023-09-03 23:00:28
合計ジャッジ時間 1,807 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
15,280 KB
testcase_01 AC 82 ms
15,040 KB
testcase_02 AC 86 ms
15,288 KB
testcase_03 AC 83 ms
15,040 KB
testcase_04 AC 80 ms
15,052 KB
testcase_05 AC 83 ms
15,124 KB
testcase_06 AC 82 ms
15,272 KB
testcase_07 AC 81 ms
15,036 KB
testcase_08 AC 81 ms
15,276 KB
testcase_09 AC 82 ms
15,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

class A
  def initialize
    w, h, c = gets.chomp.split(' ')

    o = (c == 'W')? 'B' : 'W'

    w = w.to_i
    h = h.to_i

    even_str  = ((c+o) * w).slice(0,w)
    odd_str   = ((o+c) * w).slice(0,w)

    h.times do |i|
      puts (i.even?)? even_str : odd_str
    end
  end
end

A.new
0