Your task is to write a function or program that takes two non-negative integers i
and k
(i
≤ k
), and figure out how many zeroes you'd write if you wrote all whole numbers from i
to k
(inclusive) in your base of choice on a piece of paper. Output this integer, the number of zeroes, to stdout or similar.
-30%
if you also accept a third argument b
, the integer base to write down the numbers in. At least two bases must be handled to achieve this bonus.
- You may accept the input in any base you like, and you may change the base between test cases.
- You may accept the arguments
i
,k
and optionallyb
in any order you like. - Answers must handle at least one base that is not unary.
Test cases (in base 10):
i k -> output
10 10 -> 1
0 27 -> 3
100 200 -> 22
0 500 -> 92
This is code-golf; fewest bytes win.