結果

問題 No.457 (^^*)
ユーザー compass19compass19
提出日時 2016-12-10 17:08:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 518 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,696 KB
最終ジャッジ日時 2024-05-06 17:33:55
合計ジャッジ時間 4,422 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
17,696 KB
testcase_01 AC 28 ms
10,752 KB
testcase_02 AC 27 ms
10,624 KB
testcase_03 AC 26 ms
10,624 KB
testcase_04 AC 26 ms
10,624 KB
testcase_05 AC 25 ms
10,624 KB
testcase_06 AC 28 ms
10,624 KB
testcase_07 AC 35 ms
10,624 KB
testcase_08 AC 83 ms
10,624 KB
testcase_09 AC 318 ms
10,624 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

s = input()
left_pos = [i for i, k in enumerate(s) if k == '(']
right_pos = [i for i, k in enumerate(s) if k == ')']

def solve(LorR):
	res = 0
	for i in left_pos:
		for j in right_pos:
			if j < i: continue
			if LorR == 'left':   # 左向き
				tmp = s[i+1:j]
			else:                # 右向き
				tmp = s[i+1:j][::-1]
			count = 0
			for elm in tmp:
				if count < 2:
					if elm == '^':
						count += 1
				else:
					if elm == '*':
						res += 1
						break
	return res

print(solve('left'), solve('right'))
0