結果

問題 No.539 インクリメント
ユーザー lloyz
提出日時 2022-10-03 00:04:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 731 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 13,944 KB
最終ジャッジ日時 2024-12-26 00:25:56
合計ジャッジ時間 3,277 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 RE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    S = list(input())
    n = len(S)
    L = []
    temp = ''
    for i in range(n):
        if i == 0:
            prev = S[i].isdigit()
            temp += S[i]
        else:
            if prev == S[i].isdigit():
                temp += S[i]
            else:
                L.append(temp)
                temp = S[i]
            prev = S[i].isdigit()
        if i == n - 1:
            L.append(temp)
    m = len(L)
    for i in range(m - 1, -1, -1):
        if L[i].isdigit():
            digit = len(L[i])
            num = int(L[i])
            num += 1
            L[i] = str(num)
            while len(L[i]) < digit:
                L[i] = '0' + L[i]
            break
    print(''.join(L))
0