結果
問題 | No.457 (^^*) |
ユーザー |
![]() |
提出日時 | 2017-01-12 10:40:24 |
言語 | Ruby (3.4.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 589 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 41,536 KB |
最終ジャッジ日時 | 2024-12-21 10:08:59 |
合計ジャッジ時間 | 20,536 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 TLE * 5 |
コンパイルメッセージ
Syntax OK
ソースコード
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"