結果
問題 |
No.539 インクリメント
|
ユーザー |
👑 |
提出日時 | 2022-07-12 13:50:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,558 ms / 2,000 ms |
コード長 | 1,089 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 15,508 KB |
最終ジャッジ日時 | 2024-06-23 10:35:56 |
合計ジャッジ時間 | 4,918 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
def solve(): S = input() flg = False T = [] num = [] for s in S[::-1]: if flg: T.append(s) elif s.isnumeric(): num.append(int(s)) else: if num: flg = True le = len(num) car = True for i in range(le): num[i] += 1 if num[i] == 10: num[i] = 0 else: car = False break if car: num.append(1) T += num num = [] T.append(s) if not flg and num: flg = True le = len(num) car = True for i in range(le): num[i] += 1 if num[i] == 10: num[i] = 0 else: car = False break if car: num.append(1) T += num num = [] print(*(T[::-1]), sep="") for _ in range(int(input())): solve()