The integer whose sum of digits equals N

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Châu Nhật Tăng
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Given a positive integer N, find the smallest positive integer whose sum of digits equals N.

Input

  • A positive integer N (1N107).

Output

  • The smallest positive integer whose sum of digits equals N.

Sample Input

Copy
10

Sample Output

Copy
19

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.