結果

問題 No.193 筒の数式
ユーザー ktshunktshun
提出日時 2015-06-04 20:00:51
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 579 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 6,588 KB
実行使用メモリ 6,100 KB
最終ジャッジ日時 2023-09-20 19:10:09
合計ジャッジ時間 2,135 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,884 KB
testcase_01 AC 11 ms
5,980 KB
testcase_02 AC 11 ms
5,912 KB
testcase_03 AC 11 ms
6,048 KB
testcase_04 AC 11 ms
5,948 KB
testcase_05 AC 11 ms
6,080 KB
testcase_06 AC 11 ms
6,040 KB
testcase_07 AC 11 ms
5,888 KB
testcase_08 AC 11 ms
6,048 KB
testcase_09 AC 12 ms
5,984 KB
testcase_10 AC 11 ms
6,084 KB
testcase_11 AC 11 ms
5,956 KB
testcase_12 AC 12 ms
5,848 KB
testcase_13 AC 11 ms
5,928 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding:utf-8 -*-

def calc(shiki):
	global nums
	stack = []
	ans = 0
	a = 0
	ope = "+"
	shiki+="*"
	for i in shiki:
		if i in nums:
			stack.append(int(i))
		else:
			keta = 1
			a = 0
			while len(stack) > 0:
				a += keta * stack.pop()
				keta *= 10
			if ope == "-":
				ans -= a
			else:
				ans += a
			ope = i
	return ans

if __name__ == "__main__":
	s = raw_input()
	nums = map(str,range(10))
	prev = s[len(s)-1]
	mx = 0
	for i in xrange(len(s)):
		if s[i] in nums and prev in nums:
			temp = s[i:len(s)] + s[0:i]
			mx = max(mx,calc(temp))
		prev = s[i]
	print mx
0