Digit Sums Divisible by K
Count the integers in [L, R] whose digit sum is divisible by K.
Input: the first line has L, R and K.
Output: the count of qualifying integers.
Constraints:
- 1 ≤ L ≤ R ≤ 1018
- 2 ≤ K ≤ 100
Sample Tests
Input 1
1 20 3
Output 1
6
Input 2
10 10 5
Output 2
0
Discussion (opens after you solve — no spoilers before)
No comments yet.