A11019 | Really Big Numbers
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
输入格式
The first (and the only) line contains two integers $n$ and $s$ ( $1<=n,s<=10^{18}$ ).
输出格式
Print one integer — the quantity of really big numbers that are not greater than $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$ ).
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$ ).
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted