結果

問題 No.539 インクリメント
ユーザー lloyzlloyz
提出日時 2022-10-03 00:04:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 731 bytes
コンパイル時間 75 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 11,436 KB
最終ジャッジ日時 2023-08-26 21:33:32
合計ジャッジ時間 2,333 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,784 KB
testcase_01 AC 936 ms
11,436 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