An odometer logs every integer reading from L to R inclusive. An auditor wants to know how many of those readings have a decimal digit sum exactly equal to a target value s. Count them.
A single line with three integers L, R, and s.
A single integer: the count of integers x with L <= x <= R whose decimal digits sum to s.
Example 1
Input
1 20 5
Expected
2
Explanation
Between 1 and 20 the readings with digit sum 5 are 5 and 14, so the count is 2.
Example 2
Input
10 15 6
Expected
1
Explanation
Only 15 has digit sum 6 in the range 10..15, so the answer is 1.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →