結果
| 問題 |
No.539 インクリメント
|
| コンテスト | |
| ユーザー |
Ikazuchis_diary
|
| 提出日時 | 2017-07-04 21:58:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 792 bytes |
| コンパイル時間 | 111 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 14,772 KB |
| 最終ジャッジ日時 | 2024-10-05 16:12:18 |
| 合計ジャッジ時間 | 1,237 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 1 RE * 2 |
ソースコード
import re
T = int(input())
S = []
for i in range(T):
S.append(input())
for s in S:
pattern = r'\d+'
iterator = re.finditer(pattern, s)
match = []
longest = 0
for i in iterator:
if len(i.group()) > longest:
match = []
match.append(i)
longest = len(i.group())
elif len(i.group()) == longest:
match.append(i)
if len(match) == 0:
print(s)
next
ans = ''
for i in range(len(match)):
if i == 0:
ans += s[:match[i].start()]
ans += ('%0' + str(len(match[i].group())) + 'd') % (int(match[i].group()) + 1)
if i == len(match):
ans += s[match[i].end():match[i+1].start()]
else:
ans += s[match[i].end():]
print(ans)
Ikazuchis_diary