結果

問題 No.539 インクリメント
ユーザー lloyzlloyz
提出日時 2022-10-03 00:04:40
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 731 bytes
コンパイル時間 506 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 125,660 KB
最終ジャッジ日時 2023-08-26 21:33:43
合計ジャッジ時間 3,206 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,208 KB
testcase_01 AC 250 ms
125,660 KB
testcase_02 RE -
testcase_03 RE -
権限があれば一括ダウンロードができます

ソースコード

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