Dynamic Programming (a tough one)
Posted: Sun Mar 26, 2006 10:21 pm
How many numbers with N digits are there (N is even, N<1000), so that the sum of the first N/2 digits equals the product of the last N/2 digits.
Example:
Input
2
Output
9
Explanation: 11, 22, 33, 44, 55, 66, 77, 88, 99
-------------------
Input
4
Output
207
--------------------------------------------------------
Now, I know that I should use dynamic programming to solve this one, but I don't know how. Please help!
Example:
Input
2
Output
9
Explanation: 11, 22, 33, 44, 55, 66, 77, 88, 99
-------------------
Input
4
Output
207
--------------------------------------------------------
Now, I know that I should use dynamic programming to solve this one, but I don't know how. Please help!