結果
| 問題 |
No.193 筒の数式
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-02-04 20:18:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 1,000 ms |
| コード長 | 559 bytes |
| コンパイル時間 | 371 ms |
| コンパイル使用メモリ | 82,172 KB |
| 実行使用メモリ | 51,968 KB |
| 最終ジャッジ日時 | 2024-09-28 11:20:18 |
| 合計ジャッジ時間 | 1,542 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
S = input()
N = len(S)
operator = {"+", "-"}
ans = -10 ** 10
for i in range(N):
S = S[1:] + S[:1]
if S[0] in operator:
continue
if S[-1] in operator:
continue
T = S[:] + "+"
i = 0
now = 0
tmp = 0
op = "+"
while i <= N:
if T[i] not in operator:
tmp *= 10
tmp += int(S[i])
else:
if op == "+":
now += tmp
else:
now -= tmp
tmp = 0
op = T[i]
i += 1
ans = max(ans, now)
print(ans)
ntuda