結果

問題 No.457 (^^*)
ユーザー 6soukiti29
提出日時 2017-03-23 12:22:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 819 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 16,000 KB
最終ジャッジ日時 2024-07-05 20:36:21
合計ジャッジ時間 4,755 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 9 WA * 3 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

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:
				S = S[:si] + S[si + flagk:]
				break 
	si = si + 1
print(sumL,sumR)
0