結果

問題 No.193 筒の数式
ユーザー maspymaspy
提出日時 2020-02-02 20:42:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 1,000 ms
コード長 488 bytes
コンパイル時間 179 ms
コンパイル使用メモリ 11,960 KB
実行使用メモリ 10,140 KB
最終ジャッジ日時 2023-10-19 01:26:05
合計ジャッジ時間 1,540 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,140 KB
testcase_01 AC 30 ms
10,140 KB
testcase_02 AC 30 ms
10,140 KB
testcase_03 AC 30 ms
10,140 KB
testcase_04 AC 32 ms
10,140 KB
testcase_05 AC 31 ms
10,140 KB
testcase_06 AC 30 ms
10,140 KB
testcase_07 AC 31 ms
10,140 KB
testcase_08 AC 30 ms
10,140 KB
testcase_09 AC 31 ms
10,140 KB
testcase_10 AC 31 ms
10,140 KB
testcase_11 AC 33 ms
10,140 KB
testcase_12 AC 31 ms
10,140 KB
testcase_13 AC 30 ms
10,140 KB
testcase_14 AC 30 ms
10,140 KB
testcase_15 AC 31 ms
10,140 KB
testcase_16 AC 30 ms
10,140 KB
testcase_17 AC 31 ms
10,140 KB
testcase_18 AC 30 ms
10,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = read().rstrip().decode()

INF = 10 ** 18
answer = -INF
for _ in range(20):
    S = S[-1] + S[:-1]
    if S[0] in '+-':
        continue
    if S[-1] in '+-':
        continue
    words = S.replace('+',' + ').replace('-',' - ').split()
    words[::2] = [str(int(x)) for x in words[::2]]
    x = eval(''.join(words))
    if answer < x:
        answer = x

print(answer)
0