結果

問題 No.193 筒の数式
ユーザー rpy3cpprpy3cpp
提出日時 2015-04-28 00:31:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 559 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 8,016 KB
最終ジャッジ日時 2023-09-18 13:57:15
合計ジャッジ時間 1,649 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 16 ms
7,980 KB
testcase_03 AC 16 ms
7,856 KB
testcase_04 AC 16 ms
7,820 KB
testcase_05 AC 16 ms
7,936 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,804 KB
testcase_08 AC 16 ms
7,828 KB
testcase_09 AC 16 ms
7,824 KB
testcase_10 AC 16 ms
7,804 KB
testcase_11 AC 16 ms
7,868 KB
testcase_12 AC 16 ms
7,808 KB
testcase_13 AC 16 ms
7,808 KB
testcase_14 AC 16 ms
7,740 KB
testcase_15 AC 16 ms
7,808 KB
testcase_16 AC 16 ms
7,784 KB
testcase_17 AC 16 ms
7,868 KB
testcase_18 AC 16 ms
7,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_valid_eq(eq):
    if eq.startswith('+'):
        return False
    if eq.startswith('-'):
        return False
    if eq.endswith('+'):
        return False
    if eq.endswith('-'):
        return False
    return True

def find_max(S):
    max_val = -float('inf')
    for i in range(len(S)):
        eq = S[i:] + S[:i]
        if not is_valid_eq(eq):
            continue
        try:
            val = eval(eq)            
        except:
            val = max_val
        max_val = max(val, max_val)
    return max_val

S = input()
print(find_max(S))
0