結果
問題 | No.82 市松模様 |
ユーザー |
|
提出日時 | 2023-08-04 20:05:09 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 94 ms / 5,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 49 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-10-14 17:27:06 |
合計ジャッジ時間 | 1,603 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
コンパイルメッセージ
Syntax OK
ソースコード
W, H, C1 = gets.chomp.split intw = W.to_i inth = H.to_i C2 = C1 == "B" ? "W" : "B" str1 = "" (1..intw).each do |i| str1 = if i.odd? str1 + C1 else str1 + C2 end end str2 = "" if inth != 1 (1..intw).each do |i| str2 = if i.odd? str2 + C2 else str2 + C1 end end (1..inth).each do |i| if i.odd? puts str1 else puts str2 end end else puts str1 end