CF817C.Really Big Numbers
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Ivan likes to learn different things about numbers, but he is especially interested in really big numbers. Ivan thinks that a positive integer number x is really big if the difference between x and the sum of its digits (in decimal representation) is not less than s. To prove that these numbers may have different special properties, he wants to know how rare (or not rare) they are — in fact, he needs to calculate the quantity of really big numbers that are not greater than n.
Ivan tried to do the calculations himself, but soon realized that it's too difficult for him. So he asked you to help him in calculations.
伊万喜欢学习关于数字的各种知识,但他尤其对非常大的数字感兴趣。伊万认为,一个正整数 x 是“真正大的数”,当且仅当 x 与其各位数字之和(十进制表示下)的差不小于 s。为了证明这类数字可能具有不同的特殊性质,他想了解它们出现的频率——实际上,他需要计算不大于 n 的“真正大的数”的个数。
伊万曾尝试自己进行计算,但很快意识到这对他是过于困难的。因此,他请你帮助他完成这一计算。
输入格式
The first (and the only) line contains two integers n and s (1 ≤ n, s ≤ 1018).
第一行(也是唯一一行)包含两个整数 n 和 s(1 ≤ n, s ≤ 1018)。
输出格式
Print one integer — the quantity of really big numbers that are not greater than n.
输出一个整数——不大于 n 的“真正大数”的个数。
输入输出样例
输入#1
12 1
输出#1
3
输入#2
25 20
输出#2
0
输入#3
10 9
输出#3
1
说明/提示
In the first example numbers 10, 11 and 12 are really big.
In the second example there are no really big numbers that are not greater than 25 (in fact, the first really big number is 30: 30 - 3 ≥ 20).
In the third example 10 is the only really big number (10 - 1 ≥ 9).
在第一个例子中,数字 10、11 和 12 都是真正的“大数”。
在第二个例子中,不存在不大于 25 的真正“大数”(事实上,第一个真正的“大数”是 30:30 − 3 ≥ 20)。
在第三个例子中,10 是唯一的真正“大数”(10 − 1 ≥ 9)。
输入解题思路,AI测评打分。不知道怎么写?