結果

問題 No.539 インクリメント
ユーザー mitsuomitsuo
提出日時 2018-08-22 11:03:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 717 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 7,880 KB
最終ジャッジ日時 2023-08-25 02:12:05
合計ジャッジ時間 969 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def partsolve2(l):
    l = list(l)
    addone = False
    started = False
    n = 0
    for i, c in enumerate(l[::-1]):
        n = i
        if 0x30 <= ord(c) <= 0x38:
            l[len(l) - i - 1] = chr(ord(c) + 1)
            addone = False
            break
        elif ord(c) == 0x39:
            l[len(l) - i - 1] = "0"
            addone = True
            started = True
        else:
            if addone:
                l.insert(len(l) - i, "1")
                addone = False
            if started:
                break

    if addone:
        l.insert(len(l) - n - 1, "1")

    return "".join(l)

def solve(N, lines):
    ret = []
    for l in lines:
        ret.append(partsolve2(l))
    return ret
0