結果
| 問題 | 
                            No.154 市バス
                             | 
                    
| コンテスト | |
| ユーザー | 
                             hirakich1048576
                         | 
                    
| 提出日時 | 2016-07-10 00:59:26 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 339 bytes | 
| コンパイル時間 | 96 ms | 
| コンパイル使用メモリ | 7,296 KB | 
| 実行使用メモリ | 30,920 KB | 
| 最終ジャッジ日時 | 2024-10-13 08:37:42 | 
| 合計ジャッジ時間 | 6,614 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | -- * 1 | 
| other | TLE * 1 -- * 7 | 
コンパイルメッセージ
Main.rb:2: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument Main.rb:4: warning: assigned but unused variable - bus Main.rb:17: warning: parentheses after method name is interpreted as an argument list, not a decomposed argument Main.rb:20: warning: assigned but unused variable - i Syntax OK
ソースコード
def isinvalid (str)
	bus = 0
	until str =~ /^W*$/
		isvalid = str =~ /^(W*?)WG([WG]*?)R(.*)$/
		return true unless isvalid
		str = "#{$1}#{$2}#{$3}"
	end
	false
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()
            
            
            
        
            
hirakich1048576