영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
Problem
Given an integer N, find the smallest integer with the same digit sum which is greater than N.
The digit sum of an integer is the sum of its digits, For exempel, the digit sum of 9550 is 9 + 5 + 5 + 0 = 19 and the digit sum of 999 is 9 + 9 + 9 = 27.
Input
An integer, N.
Output
Output the smallets integer greater than N with the same digit sum as N.
Scoring
| Group | Points | Limits |
| 1 | 20 | 1 ≤ N ≤ 10 |
| 2 | 20 | 1 ≤ N ≤ 100 |
| 3 | 40 | 1 ≤ N < 10000 |
| 4 | 20 | 1 ≤ N < 10^20 |
예제
예제 1
입력
8
출력
17
예제 2
입력
92
출력
119
예제 3
입력
9550
출력
9604
예제 4
입력
200
출력
1001