#P6723. [COCI 2015/2016 #5] ZAMKA
[COCI 2015/2016 #5] ZAMKA
Description
Given three integers , you need to find two integers such that:
- is the smallest integer that satisfies and the sum of the digits of is .
- is the largest integer that satisfies and the sum of the digits of is .
It is guaranteed that and exist.
Input Format
The input has three lines.
The first line contains an integer , the second line contains an integer , and the third line contains an integer .
Output Format
Output two lines.
The first line contains an integer , and the second line contains an integer .
1
100
4
4
40
100
500
12
129
480
1
10000
1
1
10000
Hint
Constraints
For of the testdata, , .
Notes
This problem is translated from COCI2015-2016 CONTEST #5 T1 ZAMKA。
Translated by ChatGPT 5
京公网安备 11011102002149号