結果
| 問題 |
No.193 筒の数式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-06-04 20:02:06 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 1,000 ms |
| コード長 | 591 bytes |
| コンパイル時間 | 46 ms |
| コンパイル使用メモリ | 7,040 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-06 14:07:58 |
| 合計ジャッジ時間 | 828 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
# -*- 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 = -float("INF")
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