結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2016-07-10 01:08:16 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 145 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 13,568 KB |
最終ジャッジ日時 | 2024-10-13 08:37:49 |
合計ジャッジ時間 | 4,715 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
コンパイルメッセージ
Main.rb:2: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument Main.rb:32: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument Main.rb:35: warning: assigned but unused variable - i Syntax OK
ソースコード
def isinvalid (str) # bus = 0 # while str =~ /[GR]/ # isvalid = str =~ /^(W*?)WG([WG]*?)R(.*)$/ # return true unless isvalid # str = "#{$1}#{$2}#{$3}" # end # false # # bus = {} bus['W'] = bus['G'] = bus['R'] = 0 str = str.split('') for c in str do bus[c] += 1 return true if bus['W'] < bus['G'] || bus['G'] < bus['R'] end bus['G'] != bus['R'] end def main () flandre = gets.chomp.to_i(10) for i in 0...flandre do str = gets.chomp x = "" x << "im" if isinvalid(str) puts x << "possible" end end main()