結果

問題 No.539 インクリメント
ユーザー Chihaya_chan
提出日時 2020-06-14 20:07:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 754 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 12,880 KB
最終ジャッジ日時 2024-06-27 21:02:38
合計ジャッジ時間 1,104 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 1 RE * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.py:7: SyntaxWarning: invalid escape sequence '\d'
  C = deque(re.split('\d+', s))

ソースコード

diff #

# 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