結果

問題 No.457 (^^*)
ユーザー ヒッキープログラミングするスレ GitHub ガチヒッキープログラミングするスレ GitHub ガチ
提出日時 2016-12-08 02:49:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 516 ms / 2,000 ms
コード長 679 bytes
コンパイル時間 488 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 76,648 KB
最終ジャッジ日時 2023-08-18 20:39:20
合計ジャッジ時間 5,468 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,244 KB
testcase_01 AC 63 ms
71,200 KB
testcase_02 AC 62 ms
71,276 KB
testcase_03 AC 60 ms
70,976 KB
testcase_04 AC 62 ms
71,052 KB
testcase_05 AC 62 ms
71,048 KB
testcase_06 AC 62 ms
71,052 KB
testcase_07 AC 71 ms
75,464 KB
testcase_08 AC 79 ms
75,256 KB
testcase_09 AC 88 ms
75,516 KB
testcase_10 AC 127 ms
76,628 KB
testcase_11 AC 271 ms
76,648 KB
testcase_12 AC 514 ms
76,476 KB
testcase_13 AC 432 ms
76,016 KB
testcase_14 AC 66 ms
75,248 KB
testcase_15 AC 516 ms
76,384 KB
testcase_16 AC 414 ms
75,980 KB
testcase_17 AC 66 ms
75,320 KB
testcase_18 AC 63 ms
71,152 KB
testcase_19 AC 61 ms
71,272 KB
権限があれば一括ダウンロードができます

ソースコード

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