Statistics

Problem Statement for "CubeBuilding"

Problem Statement

NOTE: This problem statement contains images that may not display properly if viewed outside of the applet.

Fox Ciel has R red cubes, G green cubes, and B blue cubes. The side length of each cube is 1. She is going to put all her cubes on a NxN board which is divided into 1x1 cells. Cubes must be placed within the cells, and a cell can contain a pile of multiple cubes.

The cubes that are placed on the board can be regarded as a "building". A "building" is called beautiful if and only if all visible cubes are the same color when viewing the building from the south, facing directly north.

In following figure, for example, left building is beautiful while right one is not.

Return the number of beautiful buildings she can make, modulo 1,000,000,007.

Definition

Class:
CubeBuilding
Method:
getCount
Parameters:
int, int, int, int
Returns:
int
Method signature:
int getCount(int R, int G, int B, int N)
(be sure your method is public)

Constraints

  • R, G and B will each be between 0 and 25, inclusive.
  • The sum of R,G and B will be greater than or equal to 1.
  • N will be between 1 and 25, inclusive.

Examples

  1. 1

    0

    1

    2

    Returns: 4

    There are 4 possible beautiful buildings.

  2. 1

    1

    2

    1

    Returns: 0

    In this case, it is impossible to make beautiful buildings.

  3. 2

    2

    1

    3

    Returns: 162

  4. 0

    0

    10

    12

    Returns: 372185933

  5. 1

    1

    1

    2

    Returns: 0

  6. 13

    25

    13

    2

    Returns: 0

  7. 2

    3

    9

    16

    Returns: 999984100

  8. 2

    10

    12

    24

    Returns: 999976703

  9. 13

    21

    22

    25

    Returns: 999680373

  10. 0

    1

    0

    1

    Returns: 1

  11. 9

    0

    0

    1

    Returns: 1

  12. 0

    25

    0

    1

    Returns: 1

  13. 0

    20

    1

    1

    Returns: 0

  14. 16

    25

    0

    1

    Returns: 0

  15. 13

    14

    24

    1

    Returns: 0

  16. 22

    2

    7

    1

    Returns: 0

  17. 1

    0

    0

    2

    Returns: 4

  18. 0

    9

    0

    2

    Returns: 220

  19. 0

    0

    25

    2

    Returns: 3276

  20. 1

    4

    0

    2

    Returns: 48

  21. 12

    0

    9

    2

    Returns: 560

  22. 25

    0

    16

    2

    Returns: 706860

  23. 18

    17

    21

    2

    Returns: 0

  24. 2

    5

    7

    2

    Returns: 168

  25. 25

    13

    17

    2

    Returns: 0

  26. 5

    0

    0

    19

    Returns: 521291459

  27. 0

    0

    10

    17

    Returns: 102948717

  28. 0

    0

    15

    21

    Returns: 746365076

  29. 0

    0

    20

    11

    Returns: 696363056

  30. 25

    0

    0

    24

    Returns: 850463507

  31. 0

    3

    5

    3

    Returns: 9099

  32. 6

    0

    10

    22

    Returns: 308903699

  33. 0

    9

    15

    15

    Returns: 149017039

  34. 12

    20

    0

    9

    Returns: 180941864

  35. 25

    0

    15

    8

    Returns: 758225097

  36. 0

    12

    9

    8

    Returns: 64096855

  37. 25

    17

    0

    11

    Returns: 856239698

  38. 14

    11

    0

    6

    Returns: 129433612

  39. 3

    2

    5

    21

    Returns: 214993782

  40. 6

    10

    4

    5

    Returns: 795816365

  41. 9

    6

    15

    19

    Returns: 676249657

  42. 8

    12

    20

    7

    Returns: 262615665

  43. 25

    10

    15

    10

    Returns: 523792017

  44. 2

    20

    8

    16

    Returns: 265733132

  45. 18

    1

    4

    3

    Returns: 19127103

  46. 21

    24

    6

    10

    Returns: 569373363

  47. 25

    25

    25

    1

    Returns: 0

  48. 25

    25

    25

    2

    Returns: 0

  49. 25

    25

    25

    3

    Returns: 647180287

  50. 25

    25

    25

    4

    Returns: 741812390

  51. 25

    25

    25

    5

    Returns: 422215836

  52. 25

    25

    25

    5

    Returns: 422215836

  53. 25

    25

    25

    9

    Returns: 66404265

  54. 25

    25

    25

    13

    Returns: 453982504

  55. 25

    25

    25

    17

    Returns: 891378691

  56. 25

    25

    25

    21

    Returns: 437812739

  57. 25

    25

    25

    22

    Returns: 178906838

  58. 25

    25

    25

    23

    Returns: 247873098

  59. 25

    25

    25

    24

    Returns: 902932478

  60. 25

    25

    25

    25

    Returns: 175777317

  61. 25

    25

    24

    1

    Returns: 0

  62. 25

    25

    24

    2

    Returns: 0

  63. 25

    25

    24

    3

    Returns: 242167453

  64. 25

    25

    24

    4

    Returns: 663706246

  65. 25

    25

    24

    5

    Returns: 803520573

  66. 25

    24

    25

    5

    Returns: 803520573

  67. 24

    25

    25

    9

    Returns: 998396720

  68. 25

    24

    25

    13

    Returns: 629339951

  69. 25

    24

    25

    17

    Returns: 949985298

  70. 25

    24

    25

    21

    Returns: 164357043

  71. 25

    24

    25

    22

    Returns: 11545649

  72. 25

    24

    25

    23

    Returns: 73533041

  73. 25

    24

    25

    24

    Returns: 548915463

  74. 25

    25

    24

    25

    Returns: 170126300

  75. 24

    23

    22

    25

    Returns: 995570555

  76. 25

    24

    23

    25

    Returns: 721888904

  77. 10

    13

    25

    24

    Returns: 47011342


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: