結果

問題 No.539 インクリメント
ユーザー titiatitia
提出日時 2024-02-06 08:36:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 616 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 17,172 KB
最終ジャッジ日時 2024-02-06 08:36:17
合計ジャッジ時間 4,324 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
16,788 KB
testcase_01 AC 33 ms
10,504 KB
testcase_02 TLE -
testcase_03 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.set_int_max_str_digits(0)

T=int(input())
for tests in range(T):
    S=input()

    A=[]
    flag=0
    last=-1
    B=""

    f=-1

    for i in range(len(S)-1,-1,-1):
        if flag==0 and 48<=ord(S[i])<=57:
            flag=1
            f=i

        if flag==0:
            A.append(S[i])

        if flag==1:
            if 48<=ord(S[i])<=57:
                pass
            else:
                last=i
                break

    if last>=0:
        B=S[:last+1]

    C=S[last+1:f+1]

    if C:
        X=str(int(C)+1).zfill(len(C))
    else:
        X=""

    print(B+X+"".join(A[::-1]))
    
0