結果
| 問題 |
No.539 インクリメント
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-08 20:42:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 1,104 ms / 2,000 ms |
| コード長 | 1,039 bytes |
| コンパイル時間 | 318 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 15,912 KB |
| 最終ジャッジ日時 | 2024-06-23 16:26:44 |
| 合計ジャッジ時間 | 3,752 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 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))