結果
| 問題 | No.539 インクリメント |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-08 20:42:54 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,039 bytes |
| 記録 | |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 82,404 KB |
| 実行使用メモリ | 182,408 KB |
| 最終ジャッジ日時 | 2024-06-23 16:26:47 |
| 合計ジャッジ時間 | 1,733 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | MLE * 3 |
ソースコード
T = int(input())
for i in range(T):
f1 = False
f2 = False
t = input()
n = len(t)
b = []
num = []
a = []
for j in range(n-1,-1,-1):
if not f2:
if f1 == False and t[j].isnumeric():
num.append(t[j])
f1 = True
elif f1 == False and not t[j].isnumeric():
b.append(t[j])
elif f1 and t[j].isnumeric():
num.append(t[j])
else:
a.append(t[j])
f2 = True
else:
a.append(t[j])
b.reverse()
a.reverse()
if not num:
print(*b,sep='')
else:
c = []
f = True
for s in num:
if f and s=='9':
c.append('0')
continue
elif f:
c.append(str(int(s)+1))
f = False
else:
c.append(s)
if f:
c.append('1')
c.reverse()
ans = a+c+b
print(''.join(ans))