結果
| 問題 |
No.457 (^^*)
|
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2017-03-23 12:37:02 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 495 ms / 2,000 ms |
| コード長 | 940 bytes |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-05 20:36:30 |
| 合計ジャッジ時間 | 2,711 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
6soukiti29