Digit sums divisible by d

Write codeHard35 min

Your task

Count integers x with L <= x <= R whose digit sum is divisible by d. Use range counting via f(R)-f(L-1). 0 <= L <= R <= 10^12, 1 <= d <= 100. Return the count.

Examples

count_digitsum_divisible(L: int, R: int, d: int) -> int
Example 1
Inputcount_digitsum_divisible(1, 20, 5)
Output3