結果
| 問題 | No.539 インクリメント | 
| コンテスト | |
| ユーザー |  alexara1123 | 
| 提出日時 | 2019-09-26 22:03:33 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,349 bytes | 
| コンパイル時間 | 280 ms | 
| コンパイル使用メモリ | 82,452 KB | 
| 実行使用メモリ | 88,768 KB | 
| 最終ジャッジ日時 | 2024-09-24 06:25:13 | 
| 合計ジャッジ時間 | 1,541 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 1 | 
| other | RE * 3 | 
ソースコード
from fractions import gcd
from heapq import*
import math
from collections import defaultdict, Counter
import sys
from bisect import *
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
def main():
    t = int(input())
    for i in range(t):
        s = input()
        if s.isalpha():
            print(s)
            continue
        if s.isnumeric():
            ss = list(s)
            zero = 0
            for k in range(len(s)):
                if ss[k] == "0":
                    zero += 1
                else:
                    break
            anss = str(int(s) + 1)
            print(anss.zfill(zero - len(anss) + 1))
            continue
        s = list(s)
        f = False
        num = ""
        cnt = 0
        zero = 0
        for j in range(len(s) - 1, -1, -1):
            if s[j].isdigit():
                f = True
                num += s[j]
                cnt += 1
                if s[j] == "0":
                    zero += 1
                else:
                    zero = 0
            elif not s[j].isdigit() and f:
                num2 = int(num[::-1]) + 1
                if zero <= 1:
                    zero = 0
                nnum = str(num2).zfill(len(str(num2)) + zero)
                print("".join(map(str, s[:j+1]+list(nnum)+s[j+cnt+1:])))
                break
if __name__ == '__main__':
    main()
            
            
            
        