結果
| 問題 |
No.539 インクリメント
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-24 18:41:06 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 734 bytes |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-10-01 08:15:55 |
| 合計ジャッジ時間 | 1,158 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 RE * 2 |
ソースコード
from re import findall, finditer, compile
def main():
for _ in range(int(input())):
S = input()
S = S[::-1]
prog = compile(r"\d+")
result = prog.search(S)
if result is None:
print(S[::-1])
continue
length = len(result.group())
lv_up = int(result.group()[::-1]) + 1
if len(str(lv_up)) >= length:
print((S[:result.start()] + str(lv_up)
[::-1] + S[result.end():])[::-1])
else:
print((S[:result.start()] + ("{:0"+str(length)+"d}").format(lv_up,
)[::-1] + S[result.end():])[::-1])
if __name__ == "__main__":
main()