Sobes.tech
Junior — Senior

Counting numbers in a range with a specific digit sum

livecode

Task condition

A non-negative integer value s is passed to the program. It is required to write a program that determines the number of integers in the range from 0 (inclusive) to 10^12 (excluding the upper bound), whose sum of digits equals s.

Input format A non-negative integer s (0 ≤ s ≤ 110) is given as input.

Example 1: Input: 0 Output: 1

Example 2: Input: 1 Output: 12

Example 3: Input: 12 Output: 31824