結果
| 問題 | No.539 インクリメント | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2022-02-08 20:35:18 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 990 bytes | 
| コンパイル時間 | 253 ms | 
| コンパイル使用メモリ | 82,140 KB | 
| 実行使用メモリ | 121,984 KB | 
| 最終ジャッジ日時 | 2024-06-23 16:21:26 | 
| 合計ジャッジ時間 | 1,787 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 1 RE * 2 | 
ソースコード
T = int(input())
lsT = [input() for i in range(T)]
for i in range(T):
    f1 = False
    f2 = False
    t = lsT[i]
    n = len(t)
    b = []
    num = []
    a = []
    for j in range(n-1,-1,-1):
        if not f2:
            if f1 == False and t[j].isnumeric():
                num.append(t[j])
                f1 = True
            elif f1 == False and not t[j].isnumeric():
                b.append(t[j])
            elif f1 and t[j].isnumeric():
                num.append(t[j])
            else:
                a.append(t[j])
                f2 = True
        else:
            a.append(t[j])
    b.reverse()
    num.reverse()
    a.reverse()
    if not num:
        print(*b,sep='')
    else:
        if num[0] == '0':
            nnum = int(''.join(num))
            nnum += 1
            c = '0'*(len(num)-len(str(nnum)))+str(nnum)
        else:
            nnum = int(''.join(num))
            nnum += 1
            c = str(nnum)
        print(''.join(a)+c+''.join(b))
        
            
            
            
        