結果
問題 | No.539 インクリメント |
ユーザー |
|
提出日時 | 2022-02-08 20:42:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,104 ms / 2,000 ms |
コード長 | 1,039 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 15,912 KB |
最終ジャッジ日時 | 2024-06-23 16:26:44 |
合計ジャッジ時間 | 3,752 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
T = int(input())for i in range(T):f1 = Falsef2 = Falset = input()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 = Trueelif 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 = Trueelse:a.append(t[j])b.reverse()a.reverse()if not num:print(*b,sep='')else:c = []f = Truefor s in num:if f and s=='9':c.append('0')continueelif f:c.append(str(int(s)+1))f = Falseelse:c.append(s)if f:c.append('1')c.reverse()ans = a+c+bprint(''.join(ans))