結果

問題 No.539 インクリメント
ユーザー Chihaya_chanChihaya_chan
提出日時 2020-06-14 20:07:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 754 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 10,940 KB
実行使用メモリ 11,220 KB
最終ジャッジ日時 2023-09-10 05:27:13
合計ジャッジ時間 1,287 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
9,180 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
権限があれば一括ダウンロードができます

ソースコード

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