Help with digit DP problem

Правка en2, от Reslan, 2016-08-08 15:35:32

Hello codeforces :D

I was trying to solve this problem

and I got TLE , I tried to solve it using DP.

my approach for this problem , first I find how many 369 are there in the interval [ 1 , B ] , let this value be right

then I find how many 369 are there in the interval [ 1 , A ] , let this value be left

my final answer will be right — left , if A is not 369 number

else it will be : right — left + 1

here is my code

can I do some pre calculations to avoid TLE ?

thank in advance :D

Теги #dp, digit dp, spoj, dynamic programming

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Reslan 2016-08-08 15:35:32 413
en1 Английский Reslan 2016-08-08 13:36:30 214 Initial revision (published)