cool numbers problem

Revision en2, by paramvi, 2017-01-11 14:33:59

Hi, so this problem was asked in one of the job hiring contest which is over now. So the problem is as follows:

Cool numbers are defined as numbers having digits only 2 and 5. So example of cool digits are 2, 5, 22, 25, 225, while 12, 23, 221 are not cool numbers because all their digits are not from {2, 5}. Let f(k) be defined as the function having value as a cool number greater than or equal to k. For a given pair of { L, R }, I need to evaluate ( f(L)+f(L+1)+....+f(R) ). Constraints of L, R {1<=L<=R<=10^9}

How can I solve the above problem. Any hint or approach is appreciated.


  Rev. Lang. By When Δ Comment
en2 English paramvi 2017-01-11 14:33:59 4 Tiny change: 's appreciable.' -> 's appreciated.'
en1 English paramvi 2017-01-11 14:33:27 614 Initial revision (published)