Digits
For a given integer N find how many numbers that are less or equal than N have the sum of their digitis equal to some number K.
InputFrom the first line of the standard input read two integers N and K,
N<=1000 and K<=100 separated with blank space.
N<=1000 and K<=100 separated with blank space.
OutputTo the standard output, output one integer representing the number of integers not larger than N that have the sum of the digits equal to K.
Input:
Outpu:
15 3Outpu:
2Input:
Output:
100 8Output:
9Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.