Cudak
의견: 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.
The input contains three integers \(A\), \(B\) and \(S\) (\(1 \le A \le B < 10^{15}\), \(1 \le S \le 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\).
Scoring: 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.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Subtask 1 | 80점 |
1 9 51
51 100 109
1911111 99999 245445
11499평가 및 의견
Cudak
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Cudak