結果

問題 No.539 インクリメント
コンテスト
ユーザー Chihaya_chan
提出日時 2020-06-14 20:07:05
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 754 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 578 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 20,824 KB
最終ジャッジ日時 2026-03-15 23:50:51
合計ジャッジ時間 3,209 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 1 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:7: SyntaxWarning: "\d" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\d"? A raw string is also an option.
  C = deque(re.split('\d+', s))

ソースコード

diff #
raw source code

# yukicoder
import re
from collections import deque
T = int(input())
for _ in range(T):
    s = input()
    C = deque(re.split('\d+', s))
    D = re.split("[^][0-9]+", s)
    for i in range(1, len(D)+1):
        if D[-i].isdecimal():
            N = len(D[-i])
            K=int(D[-i])+1
            K=str(K)
            D[-i]=K.zfill(N)
            break
    D = deque(D)

    ans = ""
    if s[0].isdecimal():
        P=[]
        while C or D:
          if C:
              P.append(C.popleft())
          if D:
              P.append(D.popleft())
        print("".join(P))

    else:
        P=[]
        while C or D:
          if D:
              P.append(D.popleft())
          if C:
              P.append(C.popleft())
        print("".join(P))

0