Statistics

Problem Statement for "SameDigits"

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

  1. 2

    2

    Returns: 9

    The numbers are 11, 22, 33, 44, 55, 66, 77, 88 and 99.

  2. 2

    1

    Returns: 90

  3. 3

    2

    Returns: 171

  4. 10

    124

    Returns: 0

  5. 100

    3

    Returns: 23156827

  6. 1

    1

    Returns: 9

  7. 5

    2

    Returns: 30870

  8. 1000

    30

    Returns: 13578780

  9. 1000

    1000

    Returns: 9

  10. 1

    1000

    Returns: 0

  11. 1000

    1

    Returns: 38205068

  12. 999

    38

    Returns: 40516600

  13. 597

    596

    Returns: 171

  14. 777

    21

    Returns: 44184977

  15. 1000

    500

    Returns: 40589919

  16. 991

    1000

    Returns: 0

  17. 3

    1

    Returns: 819

  18. 43

    2

    Returns: 16426438

  19. 723

    38

    Returns: 23525252

  20. 235

    11

    Returns: 8697756

  21. 746

    666

    Returns: 11111768

  22. 120

    40

    Returns: 24376721

  23. 120

    80

    Returns: 11111444

  24. 999

    998

    Returns: 171

  25. 1000

    12

    Returns: 20397180

  26. 27

    3

    Returns: 9969725

  27. 11

    3

    Returns: 11439072

  28. 58

    18

    Returns: 8453176

  29. 500

    100

    Returns: 43565933

  30. 539

    100

    Returns: 21558592

  31. 24

    4

    Returns: 27705591

  32. 999

    666

    Returns: 3963336

  33. 1000

    987

    Returns: 11430000

  34. 223

    11

    Returns: 38652188

  35. 832

    10

    Returns: 33350920

  36. 777

    555

    Returns: 29422240

  37. 708

    412

    Returns: 37780184

  38. 1000

    10

    Returns: 36533935

  39. 1000

    600

    Returns: 11114360

  40. 989

    454

    Returns: 22270248

  41. 827

    29

    Returns: 9911192

  42. 999

    345

    Returns: 33695520

  43. 999

    33

    Returns: 13730776

  44. 900

    78

    Returns: 34199500


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: