Digit Dp ?

Revision en1, by turbozone88, 2022-10-26 10:54:32

Calculate in $$$[L, R]$$$ how many numbers whose sum of digits and sum of squares of digits are primes ?

Limit :

  • $$$1 <= L <= R <= 10 ^ {18}$$$

  • $$$T <= 10 ^ 4$$$: is the number of queries $$$[L, R]$$$.

For example, in the $$$[1, 20]$$$ there are 4 numbers which are $$$11, 12, 14, 16$$$.

I did digit dp for each query and got TLE

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English turbozone88 2022-10-26 10:54:32 340 Initial revision (published)