結果

問題 No.457 (^^*)
ユーザー suppy193suppy193
提出日時 2017-01-12 10:40:24
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 589 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 11,320 KB
実行使用メモリ 19,672 KB
最終ジャッジ日時 2023-08-23 08:43:02
合計ジャッジ時間 8,797 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
19,672 KB
testcase_01 AC 82 ms
15,280 KB
testcase_02 AC 81 ms
15,280 KB
testcase_03 AC 81 ms
15,148 KB
testcase_04 AC 82 ms
15,080 KB
testcase_05 AC 82 ms
15,052 KB
testcase_06 AC 82 ms
15,060 KB
testcase_07 AC 90 ms
15,400 KB
testcase_08 AC 111 ms
15,268 KB
testcase_09 AC 186 ms
15,372 KB
testcase_10 AC 750 ms
15,296 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s = gets.strip
#puts s

re_l = /\^.*\^.*\*/ # ^^*
re_r = /\*.*\^.*\^/ # *^^

#p re_l.match(s)
#p re_r.match(s)

count_l = 0
count_r = 0
(0...s.length - 1).each do |i|
	flag_l = false
	flag_r = false
	if s[i] == '('
		(i+4...s.length).each do |j|
			if s[j] == ')'
				#puts s[i..j]
				if !flag_l
					if re_l.match(s[i..j])
						count_l += 1
						flag_l = true
					end
				else
					count_l += 1
				end
				if !flag_r
					if re_r.match(s[i..j])
						count_r += 1
						flag_r = true
					end
				else
					count_r += 1
				end
			end
		end
	end
	
end
print "#{count_l} #{count_r}\n"
0