結果
問題 | No.455 冬の大三角 |
ユーザー | mai |
提出日時 | 2016-12-06 00:21:23 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 332 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-06-29 21:04:27 |
合計ジャッジ時間 | 6,754 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - h Syntax OK
ソースコード
h,w = gets.split.map(&:to_i) sky = [] starflg = true while cin=gets if starflg && cin=~/(-*)\*.*\*/ starflg = nil elsif starflg && cin=~/(-*)\*/ x = $1.size if x == w-1 cin[x-1] = '*' else cin[x+1] = '*' end starflg = false end sky << cin end if starflg == nil f = true sky.each{|s| if f && !(s=~/\*/) puts "*"+"-"*(w-1) f = false else puts s end } else puts sky end