結果

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

ソースコード

diff #

def strip_lzero(_s):
    s = [str(int(i)) for i in _s.strip().replace("+", " ").replace("-", " ").split(" ")]
    ret = []
    ret.append(s.pop(0))
    for c in _s:
        if c == "+" or c == "-":
            ret.append(c)
            ret.append(s.pop(0))
    return "".join(ret)

S = input()

max_v = -1000000000000
for i in range(len(S)):
    s = S[i:] + S[:i]
    if s[0] == "+" or s[0] == "-" or s[len(S)-1] == "+" or s[len(S)-1] == "-":
        continue
    else:
        s = strip_lzero(s)
        v = eval(s)
        if max_v < v:
            max_v = v
print(max_v)
0