結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,100 KB
testcase_01 AC 15 ms
7,720 KB
testcase_02 AC 15 ms
7,716 KB
testcase_03 AC 16 ms
7,764 KB
testcase_04 AC 16 ms
7,804 KB
testcase_05 AC 16 ms
7,804 KB
testcase_06 AC 15 ms
7,860 KB
testcase_07 AC 21 ms
7,760 KB
testcase_08 AC 52 ms
7,724 KB
testcase_09 AC 159 ms
8,020 KB
testcase_10 AC 1,170 ms
8,032 KB
testcase_11 TLE -
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