結果
| 問題 |
No.3021 Maximize eval
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-14 21:44:07 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 195 ms / 2,000 ms |
| コード長 | 1,078 bytes |
| コンパイル時間 | 291 ms |
| コンパイル使用メモリ | 82,732 KB |
| 実行使用メモリ | 113,716 KB |
| 最終ジャッジ日時 | 2025-02-14 21:44:15 |
| 合計ジャッジ時間 | 4,476 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 |
ソースコード
import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
input = sys.stdin.readline
#sys.setrecursionlimit(10**9)
t = int(input())
#alist = list(map(int,input().split()))
#alist = []
#s = input()
#n,m = map(int,input().split())
#for i in range(n):
# alist.append(list(map(int,input().split())))
def solve():
s = list(input().rstrip())
p = 1
x = 0
n = len(s)
for i in range(n):
if s[i] == '?':
if p == 1:
s[i] = '9'
else:
if i > 0 and s[i-1] == '-':
s[i] = '1'
else:
if (i > 0 and (s[i-1] != '+' and s[i-1] != '-')) and (i != n-1 and (s[i+1] != '+' and s[i+1] != '-')):
s[i] = '+'
p = 1
else:
s[i] = '1'
if s[i] == '+':
p = 1
if s[i] == '-':
p = -1
print(''.join(s))
for i in range(t):
solve()