In this, (https://www.spoj.com/problems/TAP2012C/en/) problem, we need to find the total number in range D and H based on some property which gives in set C and a given base B.
My approach to solve this is using digit dp. I use 4 state in my dp, first is position and I use a mask for calculating which digit is using for making this number and use is_start for starting position and using nf for checking the limit. I use a flag value for checking 0 digit.
But I can not figure out what is wrong with my approach, please help me to solve this problem.
My code is here: https://ideone.com/IHsTfK