結果

問題 No.154 市バス
ユーザー angel_p_57angel_p_57
提出日時 2016-06-10 22:03:01
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 232 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 13,696 KB
最終ジャッジ日時 2024-04-21 09:30:21
合計ジャッジ時間 3,651 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:2: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

$<.each{|s|
 r=g=n=0;i=0
 puts s.chop.chars.reverse_each{|c|
  case c
  when ?R
    r+=1
  when ?G
    break if 0>r-=1
    g+=1
  else
    (break if n<1)if g<1
    g-=1
    n+=1
  end
 }&&n>0&&r<1&&g<1 ? "possible" : "impossible"
}
0