A1114 | [COCI-2007_2008-contest3]#2 CUDAK
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Božo is a strange little boy. Every day he tires his friends with strange questions. Today's question is:
how many integers in the interval [A, B] are there such that the sum of their digits is S, and which is the smallest such number?
Write a program that answers Božo's question so that he can get some sleep.
how many integers in the interval [A, B] are there such that the sum of their digits is S, and which is the smallest such number?
Write a program that answers Božo's question so that he can get some sleep.
输入格式
The input contains three integers A, B and S (1 ≤ A ≤ B < 1015, 1 ≤ S ≤ 135).
输出格式
The first line should contain the number of integers in the interval with the digit sum equal to S.
The second line should contain the smallest such integer.
The input data will guarantee that the first number is at least
1.
The second line should contain the smallest such integer.
The input data will guarantee that the first number is at least
1.
输入输出样例
输入 #1
1 9 5
输出 #1
1 5
输入 #2
1 100 10
输出 #2
9 19
输入 #3
11111 99999 24
输出 #3
5445 11499
For correctly outputting one of the two numbers you will receive 50% of the score.
Note: if you want to receive credit for just the second number, be sure to output something (0, for
example) as the first number so the judge can interpret your output correctly.
Note: if you want to receive credit for just the second number, be sure to output something (0, for
example) as the first number so the judge can interpret your output correctly.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted