結果

問題 No.193 筒の数式
ユーザー TawaraTawara
提出日時 2015-08-28 14:13:48
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 423 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 6,652 KB
実行使用メモリ 6,080 KB
最終ジャッジ日時 2023-09-25 19:02:09
合計ジャッジ時間 1,638 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,072 KB
testcase_01 AC 11 ms
5,932 KB
testcase_02 AC 11 ms
6,072 KB
testcase_03 AC 11 ms
5,972 KB
testcase_04 AC 12 ms
5,848 KB
testcase_05 AC 11 ms
6,076 KB
testcase_06 AC 11 ms
5,932 KB
testcase_07 AC 11 ms
5,860 KB
testcase_08 AC 11 ms
5,964 KB
testcase_09 AC 11 ms
5,928 KB
testcase_10 AC 12 ms
6,064 KB
testcase_11 AC 11 ms
5,852 KB
testcase_12 AC 12 ms
6,080 KB
testcase_13 AC 11 ms
5,872 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = raw_input()
N = len(S)
ans = 0
for i in range(N):
	if S[i-1].isdigit() and S[i].isdigit():
		tmp = pre = 0
		op = "+"
		ns = S[i:N] + S[0:i]
		for i in range(N):
			if ns[i].isdigit():
				continue
			if op == "+":
				tmp += int(ns[pre:i])
			else:
				tmp -= int(ns[pre:i])
			op = ns[i]
			pre = i+1
		else:
			if op == "+":
				tmp += int(ns[pre:N])
			else:
				tmp -= int(ns[pre:N])
		ans = max(ans,tmp)
print ans
0