Logo
(追記) (追記ここまで)

11874번 - ZAMKA 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 64 MB92272267780.308%

문제

The impossible has happened. Bear G. has fallen into his own trap. Lured by a delicious box of Domaćica, without even thinking, he rushed and fell into his trap. In order to get out of the trap, he must solve the following task with your help. You are given three integers L, D i X.

  • determine the minimal integer N such that L ≤ N ≤ D and the sum of its digits is X
  • determine the maximal integer M such that L ≤ M ≤ D and the sum of its digits is X

Bear will be able to escape from the trap if he correctly determines numbers N and M. The numbers N and M will always exist.

입력

The first line of input contains the integer L (1 ≤ L ≤ 10 000), the number from the task.

The second line of input contains the integer D (1 ≤ D ≤ 10 000, L ≤ D), the number from the task.

The third line of input contains the integer X (1 ≤ X ≤ 36), the number from the task.

출력

The first line of output must contain the integer N from the task.

The second line of output must contain the integer M from the task

제한

예제 입력 1

1
100
4

예제 출력 1

4
40

예제 입력 2

100
500
12

예제 출력 2

129
480

예제 입력 3

1
10000
1

예제 출력 3

1
10000

힌트

출처

Contest > Croatian Open Competition in Informatics > COCI 2015/2016 > Contest #5 1번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /