結果
問題 | No.3021 Maximize eval |
ユーザー |
![]() |
提出日時 | 2025-02-14 22:18:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 231 ms / 2,000 ms |
コード長 | 743 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 82,600 KB |
実行使用メモリ | 138,432 KB |
最終ジャッジ日時 | 2025-02-14 22:19:00 |
合計ジャッジ時間 | 3,994 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge7 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 15 |
ソースコード
T=int(input())for _ in range(T):S=input();d=0if S[0]!='+' and S[0]!='-':S='+'+Sd=1A=[];B=[]for s in S:if s=='-' or s=='+':if len(B)!=0:A.append(B)B=[]B.append(s)A.append(B)ans=[]for i in range(len(A)):if A[i][0]=='+':for j in range(len(A[i])):if A[i][j]=='?':A[i][j]='9'else:if len(A[i])!=1 and A[i][1]=='?':A[i][1]='1'f=0for j in range(len(A[i])):if f==0 and j!=len(A[i])-1 and A[i][j]=='?':f=1;A[i][j]='+'if A[i][j]=='?':if f==1:A[i][j]='9'else:A[i][j]='1'for s in A[i]:ans.append(s)print(''.join(ans[d:]))