結果
問題 | No.82 市松模様 |
ユーザー |
![]() |
提出日時 | 2016-06-05 15:36:44 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 81 ms / 5,000 ms |
コード長 | 390 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 14,208 KB |
最終ジャッジ日時 | 2024-10-08 15:45:24 |
合計ジャッジ時間 | 1,685 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
コンパイルメッセージ
Main.rb:11: warning: mismatched indentations at 'else' with 'if' at 8 Main.rb:13: warning: mismatched indentations at 'end' with 'else' at 11 Syntax OK
ソースコード
w, h, c = gets.strip.split(' ') w = w.to_i h = h.to_i result = '' h.times {|i| w.times {|j| result += if i % 2 == 0 then if j % 2 == 0 then '0' else '1' end else if j % 2 == 1 then '0' else '1' end end } result += "\n" } if c === 'W' then result.gsub!('0', 'W').gsub!('1', 'B') else result.gsub!('0', 'B').gsub!('1', 'W') end puts result