ti got TLE for this problem .
http://www.z-trening.com/submit.php?subm_stat=1&submit=7100131222
Can anyone give me a hint to upgrade my speed ?
dyou program have complexity O( (b-a)*NumberOfDigits ), and that is about 10^7*6 in works case ...
so that is 6*10^7, and that is too many operation for 0,4 seconds.
Hint: When you really need to check sum of digits of some number, and when you can just to calculate sum of digits from previous number ?
di see you are getting still TLE.
mb I haven't explained good.
just see this:
sum(129) = sum(128) + 1
sum(128) = sum(127) + 1
sum(127) = sum(126) + 1
.
.
.
sum(121) = sum(120) + 1
but sum(120) != sum(119) + 1
tthank you very much . Got Ac now :D