結果

問題 No.154 市バス
ユーザー hirakich1048576hirakich1048576
提出日時 2016-07-10 00:59:26
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 339 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 31,160 KB
最終ジャッジ日時 2024-04-21 09:50:04
合計ジャッジ時間 6,636 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

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()
0