結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-18 11:36:55 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 422 bytes |
| コンパイル時間 | 281 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 13,568 KB |
| 最終ジャッジ日時 | 2024-10-13 08:45:53 |
| 合計ジャッジ時間 | 3,277 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 4 WA * 4 |
コンパイルメッセージ
Syntax OK
ソースコード
ws = 0
gs = 0
gets.to_i.times do
possible = true
gets.chomp.chars.each do |c|
case c
when "W"
ws += 1
when "G"
if ws <= 0
possible = false
break
end
ws -= 1
gs += 1
when "R"
if gs <= 0
possible = false
break
end
gs -= 1
end
end
if possible && gs.zero?
puts "possible"
else
puts "impossible"
end
end