結果

問題 No.457 (^^*)
ユーザー 6soukiti296soukiti29
提出日時 2017-03-23 12:22:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 819 bytes
コンパイル時間 863 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 12,608 KB
最終ジャッジ日時 2023-09-19 08:49:17
合計ジャッジ時間 5,397 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,384 KB
testcase_01 AC 16 ms
7,804 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 16 ms
7,800 KB
testcase_05 AC 16 ms
7,784 KB
testcase_06 AC 17 ms
7,804 KB
testcase_07 AC 18 ms
7,784 KB
testcase_08 AC 22 ms
8,104 KB
testcase_09 AC 34 ms
8,084 KB
testcase_10 WA -
testcase_11 AC 423 ms
8,336 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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