How to optimize dynamic programming?
- by Chan
Problem A number is called lucky if the sum of its digits, as well as the sum of the squares of its digits is a prime number. How many
numbers between A and B are lucky?
Input: The first line contains the number of test cases T. Each of the next T lines contains two integers, A and B.
Output: Output T lines, one for each case…