結果
問題 | No.539 インクリメント |
ユーザー | rlangevin |
提出日時 | 2023-02-22 12:29:48 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 817 bytes |
コンパイル時間 | 401 ms |
コンパイル使用メモリ | 87,040 KB |
実行使用メモリ | 99,724 KB |
最終ジャッジ日時 | 2023-09-29 20:41:04 |
合計ジャッジ時間 | 2,209 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 69 ms
71,240 KB |
testcase_01 | AC | 146 ms
99,724 KB |
testcase_02 | AC | 141 ms
97,968 KB |
testcase_03 | RE | - |
ソースコード
T = int(input()) S = set(range(10)) S = set(map(str, S)) for _ in range(T): s = list(input()) flag = 0 pre, num = [], [] while s: if flag == 0: if s[-1] not in S: pre.append(s.pop()) elif s[-1] == "9": num.append(s.pop()) flag = 1 else: num.append(s.pop()) flag = 2 elif flag == 1: if s[-1] not in S: break elif s[-1] == "9": num.append(s.pop()) else: num.append(s.pop()) flag = 2 else: break pre.reverse() num.reverse() if num: num = int("".join(num)) + 1 s.extend(list(str(num))) s.extend(pre) print("".join(s))