結果

問題 No.193 筒の数式
ユーザー 👑 KazunKazun
提出日時 2021-01-07 18:08:06
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 477 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 66,692 KB
最終ジャッジ日時 2024-04-26 10:09:43
合計ジャッジ時間 1,902 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 37 ms
52,692 KB
testcase_03 AC 38 ms
53,304 KB
testcase_04 AC 37 ms
53,084 KB
testcase_05 AC 36 ms
53,468 KB
testcase_06 AC 41 ms
53,000 KB
testcase_07 AC 38 ms
53,248 KB
testcase_08 AC 37 ms
53,148 KB
testcase_09 AC 37 ms
53,216 KB
testcase_10 AC 38 ms
51,952 KB
testcase_11 RE -
testcase_12 AC 38 ms
53,136 KB
testcase_13 AC 38 ms
53,076 KB
testcase_14 AC 36 ms
52,872 KB
testcase_15 AC 38 ms
52,092 KB
testcase_16 AC 37 ms
53,164 KB
testcase_17 AC 38 ms
53,300 KB
testcase_18 AC 37 ms
52,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S=input()
N=len(S)

X=-float("inf")
for _ in range(N):
    F=1
    for i in range(N-1):
        if S[i:i+2] in {"++","+-","-+","--"}:
            S=S[1:]+S[0]
            continue
    if {S[0],S[-1]} & {"+","-"}:
        S=S[1:]+S[0]
        continue

    T=S
    while True:
        U=T
        T=T.replace("+0","+")
        T=T.replace("-0","-")
        if U==T:
            break

    if T[0]=="+" or T[0]=="-":
        T+="0"

    X=max(X,eval(T))
    S=S[1:]+S[0]
print(X)
0