結果
問題 |
No.457 (^^*)
|
ユーザー |
![]() |
提出日時 | 2017-03-23 12:35:54 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 334 ms / 2,000 ms |
コード長 | 940 bytes |
コンパイル時間 | 159 ms |
コンパイル使用メモリ | 81,792 KB |
実行使用メモリ | 83,200 KB |
最終ジャッジ日時 | 2024-07-05 20:36:35 |
合計ジャッジ時間 | 2,954 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
S = list(input()) kl = 0 sumL = 0 sumR = 0 si = 0 while si < len(S): s = S[si] if s == "(": flagl = 0 flagr = 0 flagk = 0 kr = 0 countstar = 0 countyama = 0 countstya = 0 Lface = 0 Rface = 0 for ti,t in enumerate(S[si + 1:]): if ti == 0 + flagk and t == "(": flagk = flagk + 1 elif t == "*": countstar = countstar + 1 if countyama >= 2 and flagl == 0: Lface = (flagk + 1) * (S[ti + si + 1:].count(")")) sumL = sumL + Lface flagl = 1 elif t == "^": countyama = countyama + 1 if countstya == 1 and flagr == 0: Rface = (flagk + 1) * (S[ti + si + 1:].count(")")) sumR = sumR + Rface flagr = 1 elif countstar >= 1: countstya = 1 if (flagr == 1 and flagl == 1) or ti == len(S[si + 1:]) -1: if si > 0 and flagk > 0: S = S[:si] + S[si + flagk:] elif flagk > 0: S = [S[0]] + S[si + flagk + 1:] break si = si + 1 print(sumL,sumR)