304369: CF835B. The number on the board

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

The number on the board

题意翻译

给出两个正整数 $k,n$,其中的 $n$ 被修改过,你需要修改 $n$ 中的某几位,使新的 $n$ 的各个位置的和不小于 $k$,求最小的修改次数。

题目描述

Some natural number was written on the board. Its sum of digits was not less than $ k $ . But you were distracted a bit, and someone changed this number to $ n $ , replacing some digits with others. It's known that the length of the number didn't change. You have to find the minimum number of digits in which these two numbers can differ.

输入输出格式

输入格式


The first line contains integer $ k $ ( $ 1<=k<=10^{9} $ ). The second line contains integer $ n $ ( $ 1<=n&lt;10^{100000} $ ). There are no leading zeros in $ n $ . It's guaranteed that this situation is possible.

输出格式


Print the minimum number of digits in which the initial number and $ n $ can differ.

输入输出样例

输入样例 #1

3
11

输出样例 #1

1

输入样例 #2

3
99

输出样例 #2

0

说明

In the first example, the initial number could be $ 12 $ . In the second example the sum of the digits of $ n $ is not less than $ k $ . The initial number could be equal to $ n $ .

Input

题意翻译

给出两个正整数 $k,n$,其中的 $n$ 被修改过,你需要修改 $n$ 中的某几位,使新的 $n$ 的各个位置的和不小于 $k$,求最小的修改次数。

加入题单

上一题 下一题 算法标签: