結果

問題 No.539 インクリメント
ユーザー AEnAEn
提出日時 2022-06-14 17:54:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 667 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 147,092 KB
最終ジャッジ日時 2024-04-10 12:51:26
合計ジャッジ時間 2,081 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

n = int(input())

num = set([str(i) for i in range(10)])
for i in range(n):
    S = input()
    ans = []
    f = False
    s = 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')
            s = False
            ans.append(S[j])
        else:
            ans.append(S[j])
    print(''.join(ans)[::-1])
0