結果

問題 No.193 筒の数式
コンテスト
ユーザー yumechi
提出日時 2015-04-27 00:37:18
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 809 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 598 ms
コンパイル使用メモリ 20,740 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-03-26 10:18:26
合計ジャッジ時間 4,627 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

S = input()
maxnum = -9999999999999999999999999
length = len(S)
ckecknum = lambda x: not (x == "+" or x == "-")
for i in range(length):
    line = S[i:length] + S[0:i]

    tline = line
    while tline[0] == "0":
        tline = tline[1:len(tline)]
    j = 1
    while j < len(tline):
        if (tline[j - 1] == "+" or tline[j - 1] == "-") and tline[j] == "0":
            if j == len(tline) - 1:
                break
            else:
                if tline[j+1].isdigit():
                    tline = tline[0:j] + tline[j+1:len(tline)]
        else:
            j += 1
    line = tline

    first = line[0]
    end = line[len(line) - 1]
    if not ckecknum(first) or not ckecknum(end):
        continue
    
    try:
        maxnum = max(maxnum, eval(line))
    except:
        pass
print(maxnum)
     
0