結果

問題 No.193 筒の数式
ユーザー flippergo
提出日時 2025-01-01 15:09:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 58 ms / 1,000 ms
コード長 430 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 65,036 KB
最終ジャッジ日時 2025-01-01 15:09:25
合計ジャッジ時間 2,686 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
def safe_eval(expression):
    # 演算子の前後にあるリーディングゼロを除去
    processed_expression = re.sub(r'(?<!\d)0+(\d+)', r'\1', expression)
    return eval(processed_expression)
S = input().strip()

NUM = [str(i) for i in range(10)]
ans = -10**10
for i in range(len(S)):
    x = S[i:]+S[:i]
    if x[0] not in NUM or x[-1] not in NUM:
        continue
    ans = max(ans,safe_eval(x))
print(ans)
0