結果

問題 No.457 (^^*)
ユーザー compass19compass19
提出日時 2016-12-10 17:17:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 599 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,776 KB
実行使用メモリ 8,000 KB
最終ジャッジ日時 2023-08-19 10:22:34
合計ジャッジ時間 1,281 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

from tqdm import tqdm
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
	is_exist = False
	for i in tqdm(left_pos):
		for j in right_pos:
			if j < i: continue
			if is_exist: res += 1; 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