#P1708. Count Nebula Numbers
Count Nebula Numbers
Count Nebula Numbers
Define a Nebula Number as a positive integer with at most \(n\) digits and whose digits sum to no more than \(k\). Given two positive integers \(n\) and \(k\), count the total number of Nebula Numbers.
Note: A number is considered to have \(m\) digits if it does not have any leading zeros. For example, when \(n=2\), both 7 and 23 are counted (if they satisfy the conditions), but 07 is not considered a valid 2-digit number.
The answer must be computed exactly (without taking modulo).
inputFormat
The input consists of a single line containing two integers \(n\) and \(k\) separated by a space.
\(n\): Maximum number of digits (1 ≤ n)
\(k\): Maximum allowed sum of digits (k ≥ 0)
outputFormat
Output a single integer representing the number of Nebula Numbers that satisfy the given conditions.
sample
1 5
5