結果
| 問題 |
No.3021 Maximize eval
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2025-02-15 09:00:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 122 ms / 2,000 ms |
| コード長 | 636 bytes |
| コンパイル時間 | 268 ms |
| コンパイル使用メモリ | 82,156 KB |
| 実行使用メモリ | 101,236 KB |
| 最終ジャッジ日時 | 2025-02-15 09:00:46 |
| 合計ジャッジ時間 | 3,053 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
def main():
t = int(input())
for _ in range(t):
s = list(input())
n = len(s)
ans = s.copy()
f = 1
for i in range(n):
if s[i]=="?":
if f:
ans[i] = "9"
elif (i==0 or (s[i-1]!="+" and s[i-1]!="-")) and (i < n-1 and s[i+1]!="+" and s[i+1]!="-"):
ans[i] = "+"
f = 1
else:
ans[i] = "1"
elif s[i]=="+":
f = 1
elif s[i]=="-":
f = 0
print("".join(ans))
if __name__ == "__main__":
main()