P21002 [GeeksforGeeks] Smallest number with sum of digits as n and divisible by 10n4032
普及-
题目描述

Find the smallest number such that the sum of its digits is N and it is divisible by 10^{N}.
Example 1:
Input: N = 5
Outptut: 500000
Explanation: Sum of digits of 500000
is 5 and divisible by 10^{5}.
Example 2:
Input: N = 20
Output: 29900000000000000000000
Explanation: Sum of digits of
29900000000000000000000 is 20 and
divisible by 10^{20}.
Your Task:
You don't need to read or print anything. Your task is to complete the function digitsNum() which takes the input parameter N and returns the smallest number such that sum of its digits is N and divisible by 10^{N}.

Expected Time Complexity: O(N)
Expected Space Complexity: O(N)

Constraints:
1 <= N <= 10000

输入格式

见题面

输出格式

见题面

样例输入
N = 20
样例输出
29900000000000000000000