結果
問題 | No.539 インクリメント |
ユーザー |
![]() |
提出日時 | 2022-06-14 18:32:57 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,679 ms / 2,000 ms |
コード長 | 935 bytes |
コンパイル時間 | 151 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 16,776 KB |
最終ジャッジ日時 | 2024-10-02 15:33:06 |
合計ジャッジ時間 | 5,551 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 3 |
ソースコード
def main():n = int(input())num = set([str(i) for i in range(10)])for i in range(n):S = input()ans = []f = Falses = Falseok = Falsefor j in reversed(range(len(S))):if f == False and S[j] in num:a, b = (int(S[j])+1)//10, (int(S[j])+1)%10ans.append(str(b))s = Truef = Trueelif s == True and S[j] in num:a, b = (int(S[j])+a)//10, (int(S[j])+a)%10ans.append(str(b))elif s == True:if a == 1:ans.append('1')ok = Trues = Falseans.append(S[j])else:ans.append(S[j])if f == True and ok == False and a == 1:ans.append('1')print(''.join(ans)[::-1])if __name__ == '__main__':main()