結果
問題 | No.539 インクリメント |
ユーザー | Theta |
提出日時 | 2022-11-24 18:32:58 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 690 bytes |
コンパイル時間 | 117 ms |
コンパイル使用メモリ | 11,904 KB |
実行使用メモリ | 11,684 KB |
最終ジャッジ日時 | 2024-04-08 15:45:41 |
合計ジャッジ時間 | 1,226 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 28 ms
9,984 KB |
testcase_01 | AC | 135 ms
11,684 KB |
testcase_02 | RE | - |
testcase_03 | RE | - |
ソースコード
from re import findall, finditer, compile def main(): for _ in range(int(input())): S = input() prog = compile(r"\d+") try: results = list(prog.finditer(S))[-1] except IndexError: print(S) continue length = len(results.group()) lv_up = int(results.group()) + 1 if len(str(lv_up)) >= length: print(S[:results.start()] + str(lv_up) + S[results.end():]) else: print(S[:results.start()] + ("{:0"+str(length)+"d}").format(lv_up, ) + S[results.end():]) if __name__ == "__main__": main()