結果
問題 | No.539 インクリメント |
ユーザー | Theta |
提出日時 | 2022-11-24 18:28:08 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 653 bytes |
コンパイル時間 | 465 ms |
コンパイル使用メモリ | 11,904 KB |
実行使用メモリ | 11,520 KB |
最終ジャッジ日時 | 2024-04-08 15:40:31 |
合計ジャッジ時間 | 1,577 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
9,984 KB |
testcase_01 | AC | 140 ms
11,520 KB |
testcase_02 | RE | - |
testcase_03 | RE | - |
ソースコード
from re import findall, finditer def main(): for _ in range(int(input())): S = input() try: results = list(finditer(r"\d+", 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()