結果
問題 |
No.3021 Maximize eval
|
ユーザー |
![]() |
提出日時 | 2025-02-14 23:29:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 163 ms / 2,000 ms |
コード長 | 718 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 82,712 KB |
実行使用メモリ | 133,236 KB |
最終ジャッジ日時 | 2025-02-14 23:30:41 |
合計ジャッジ時間 | 3,421 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 15 |
ソースコード
t = int(input()) for _ in range(t): s = list(input()) n = len(s) stack = list() sign = "+" ans = "" for i in range(n): if s[i]=="+": stack.append("+") sign = "+" elif s[i]=="-": stack.append("-") sign = "-" else: if s[i]=="?" and sign=="+": stack.append("9") elif s[i]=="?" and sign=="-": if 0<i<n-1 and s[i-1]!="-" and not s[i+1] in ["-","+"]: stack.append("+") sign = "+" else: stack.append("1") else: stack.append(s[i]) ans = "".join(stack) print(ans)