CF835B.The number on the board
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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.
黑板上写了一个自然数,其各位数字之和不小于 k。但你稍一分神,有人将这个数改成了 n,即用其他数字替换了其中若干位数字。已知该数的位数未发生变化。
你需要求出这两个数在最少多少位数字上不同。
输入格式
The first line contains integer k (1 ≤ k ≤ 109).
The second line contains integer n (1 ≤ n < 10100000).
There are no leading zeros in n. It's guaranteed that this situation is possible.
第一行包含一个整数 k(1 ≤ k ≤ 109)。
第二行包含一个整数 n(1 ≤ n < 10100000)。
n 不含前导零。题目保证该情况是可能的。
输出格式
Print the minimum number of digits in which the initial number and n can differ.
输出初始数字与 n 在多少位数字上存在差异的最小值。
输入输出样例
输入#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.
在第一个例子中,初始数字可以是 12。
在第二个例子中,$ n $ 的各位数字之和不小于 $ k $。初始数字可以等于 $ n $。
输入解题思路,AI测评打分。不知道怎么写?