結果
問題 | 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 ** 10for i in range(N):S = S[1:] + S[:1]if S[0] in operator:continueif S[-1] in operator:continueT = S[:] + "+"i = 0now = 0tmp = 0op = "+"while i <= N:if T[i] not in operator:tmp *= 10tmp += int(S[i])else:if op == "+":now += tmpelse:now -= tmptmp = 0op = T[i]i += 1ans = max(ans, now)print(ans)