結果

問題 No.539 インクリメント
コンテスト
ユーザー AEn
提出日時 2022-06-14 17:57:53
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
MLE  
実行時間 -
コード長 773 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 149 ms
コンパイル使用メモリ 85,632 KB
実行使用メモリ 145,572 KB
最終ジャッジ日時 2026-04-19 00:27:48
合計ジャッジ時間 3,111 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other MLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())

num = set([str(i) for i in range(10)])
for i in range(n):
    S = input()
    ans = []
    f = False
    s = False
    ok = False
    for j in reversed(range(len(S))):
        if f == False and S[j] in num:
            a, b = (int(S[j])+1)//10, (int(S[j])+1)%10
            ans.append(str(b))
            s = True
            f = True
        elif s == True and S[j] in num:
            a, b = (int(S[j])+a)//10, (int(S[j])+a)%10
            ans.append(str(b))
        elif s == True:
            if a == 1:
                ans.append('1')
            ok = True
            s = False
            ans.append(S[j])
        else:
            ans.append(S[j])
    if f == True and ok == False and a == 1:
        ans.append('1')
    print(''.join(ans)[::-1])
0