結果

問題 No.193 筒の数式
ユーザー zombietanzombietan
提出日時 2016-05-30 07:10:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 527 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-07 17:57:36
合計ジャッジ時間 1,548 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
S = input()
formula = deque(S)

ans = []
for _ in range(len(S)):
    formula.rotate(1)
    s = ''.join(formula)
    if s[0] != '+' and s[0] != '-' and s[-1] != '+' and s[-1] != '-':
        num = ''
        f = []
        for n in s:
            if n.isdigit():
                num += n
            else:
                f.append(str(int(num)))
                f.append(n)
                num = ''
        f.append(str(int(num)))
        m = ''.join(f)
        ans.append(eval(m))

print(max(ans))
0