Comments
On Nourin_Eka → Digit DP, 14 years ago
0

So far I could guess your DP (int pos, int moded, bool preSmall) gives the number of integers divisible by k, not whose sum of digits also divisible by k. LOJ 1068 requires that. And if I my guess is correct then it can be calculated mathematically, n/k gives us the number of integers less than or equal to n divisible by k. DP(int pos, int moded, int preSmall, int sum) I think if we design the DP like this one, it may answer that question, but complexity grows 10*1e4*2*83 which is neither time nor memory efficient. How can we optimize it further.