結果

問題 No.3021 Maximize eval
ユーザー moon17
提出日時 2025-02-14 23:41:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 586 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 83,036 KB
実行使用メモリ 161,196 KB
最終ジャッジ日時 2025-02-14 23:42:44
合計ジャッジ時間 5,095 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

t=int(input())
for _ in range(t):
  s=input()
  st=[[]]
  for c in s:
    if c in'+-':
      st+=[c],
    else:
      st[-1]+=c,
  ans=[]
  for t in st:
    if not t:
      continue
    m=t[0]=='-'
    for i in range(len(t)):
      c=t[i]
      if c!='?':
        if m==1 and i:
          m=2
        ans+=c,
        continue
      if i==len(t)-1:
        if m:
          ans+='1',
        else:
          ans+='9',
      else:
        if m==1:
          m=2
          ans+='1',
        elif m==2:
          ans+='+',
          m=0
        else:
          ans+='9',
  print(*ans,sep='')
0