結果

問題 No.457 (^^*)
ユーザー ヒッキープログラミングするスレ GitHub ガチ
提出日時 2016-12-08 02:49:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 597 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 1,778 ms
コンパイル使用メモリ 81,580 KB
実行使用メモリ 75,776 KB
最終ジャッジ日時 2024-11-28 04:22:22
合計ジャッジ時間 4,968 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()

def solve(s):
    left = 0
    right = 0
    
    for i in range(len(s)):
        if s[i] != '(':
            continue
        lfc = 0
        rfc = 0
        for j in range(i + 1, len(s)):
            if s[j] == '^':
                if lfc < 2:
                    lfc += 1
                if rfc > 0:
                    rfc += 1
            elif s[j] == '*':
                if lfc == 2:
                    lfc = 3
                if rfc == 0:
                    rfc = 1
            elif s[j] == ')':
                if lfc > 2:
                    left += 1
                if rfc > 2:
                    right += 1
    return [left, right]


print(*solve(s))
0