結果
| 問題 | No.193 筒の数式 |
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-02-04 20:18:34 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 1,000 ms |
| コード長 | 559 bytes |
| 記録 | |
| コンパイル時間 | 274 ms |
| コンパイル使用メモリ | 85,240 KB |
| 実行使用メモリ | 53,820 KB |
| 最終ジャッジ日時 | 2026-04-15 02:47:03 |
| 合計ジャッジ時間 | 1,573 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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