TopCoder problem "SameDigits" used in SRM 358 (Division II Level Three)



Problem Statement

    Let's define a function f over positive integers which returns the longest subsequence of the same digits in the number.

So, f(344488) = 3 and f(123) = 1.



Given an int n and int k, return an int stating how many numbers, no longer than n digits has f(x) = k. Return the result modulo 44444444.
 

Definition

    
Class:SameDigits
Method:howMany
Parameters:int, int
Returns:int
Method signature:int howMany(int n, int k)
(be sure your method is public)
    
 

Constraints

-n and k will be between 1 and 1000, inclusive.
 

Examples

0)
    
2
2
Returns: 9
The numbers are 11, 22, 33, 44, 55, 66, 77, 88 and 99.
1)
    
2
1
Returns: 90
2)
    
3
2
Returns: 171
3)
    
723
38
Returns: 23525252

Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=7705

Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=10768&pm=7705

Writer:

icanadi

Testers:

PabloGilberto , brett1479 , Olexiy , Andrew_Lazarev

Problem categories:

Dynamic Programming