Statistics

Problem Statement for "FoxMakingDice"

Problem Statement

Fox Jiro likes dice. He wants to make his own dice. Each die he wants to make is a cube. Each of the 6 faces has an integer between 1 and N, inclusive. No two faces have same number. Also the following condition must be satisfied: for all faces, the sum of the numbers on opposite faces must be equal and the sum must be greater than or equal to K.


He realized that there are many ways to make such dice. He wants to know how many ways there are. Please help Jiro to make a program that is given two integers N and K and returns the number of different dice satisfying the condition mentioned above.


Two dice are considered the same if you can rotate one to form the other.

Definition

Class:
FoxMakingDice
Method:
theCount
Parameters:
int, int
Returns:
long
Method signature:
long theCount(int N, int K)
(be sure your method is public)

Notes

  • The answer will always fit in a signed 64-bit integer.

Constraints

  • N will be between 1 and 1,000, inclusive.
  • K will be between 1 and 2,000, inclusive.

Examples

  1. 6

    7

    Returns: 2

    You can make normal dice. There are two ways to arrange the numbers.

  2. 5

    7

    Returns: 0

    You cannot make 6 sided dice with 5 numbers.

  3. 1000

    1

    Returns: 20625666000

  4. 456

    123

    Returns: 879075732

  5. 913

    1014

    Returns: 4506149340

  6. 1000

    2

    Returns: 20625666000

  7. 1000

    3

    Returns: 20625666000

  8. 1000

    4

    Returns: 20625666000

  9. 1000

    5

    Returns: 20625666000

  10. 1000

    6

    Returns: 20625666000

  11. 1000

    7

    Returns: 20625666000

  12. 1000

    8

    Returns: 20625665998

  13. 1000

    9

    Returns: 20625665996

  14. 1000

    10

    Returns: 20625665988

  15. 1000

    499

    Returns: 20000303496

  16. 1000

    500

    Returns: 19995219248

  17. 1000

    501

    Returns: 19990135000

  18. 1000

    999

    Returns: 10415878496

  19. 1000

    1000

    Returns: 10374709998

  20. 1000

    1499

    Returns: 651031250

  21. 1000

    1500

    Returns: 645823000

  22. 1000

    1501

    Returns: 640677000

  23. 1000

    1991

    Returns: 40

  24. 1000

    1992

    Returns: 20

  25. 1000

    1993

    Returns: 12

  26. 1000

    1994

    Returns: 4

  27. 1000

    1995

    Returns: 2

  28. 1000

    1996

    Returns: 0

  29. 1000

    1997

    Returns: 0

  30. 1000

    1998

    Returns: 0

  31. 1000

    1999

    Returns: 0

  32. 1000

    2000

    Returns: 0

  33. 999

    5

    Returns: 20543080502

  34. 999

    6

    Returns: 20543080502

  35. 999

    7

    Returns: 20543080502

  36. 999

    8

    Returns: 20543080500

  37. 999

    9

    Returns: 20543080498

  38. 999

    10

    Returns: 20543080490

  39. 1

    1

    Returns: 0

  40. 2

    1

    Returns: 0

  41. 3

    1

    Returns: 0

  42. 4

    1

    Returns: 0

  43. 5

    1

    Returns: 0

  44. 6

    1

    Returns: 2

  45. 7

    1

    Returns: 6

  46. 8

    1

    Returns: 16

  47. 9

    1

    Returns: 32

  48. 10

    1

    Returns: 60

  49. 233

    379

    Returns: 569492

  50. 779

    1081

    Returns: 534747682

  51. 293

    522

    Returns: 163680

  52. 901

    434

    Returns: 13221642600

  53. 99

    69

    Returns: 1620048

  54. 631

    993

    Returns: 53733330

  55. 468

    517

    Returns: 317997680

  56. 37

    46

    Returns: 5460

  57. 419

    488

    Returns: 154523600

  58. 31

    14

    Returns: 13550

  59. 888

    1644

    Returns: 3065920

  60. 61

    103

    Returns: 1080

  61. 527

    898

    Returns: 6010004

  62. 539

    61

    Returns: 1725844952

  63. 236

    462

    Returns: 60

  64. 648

    409

    Returns: 3336677652

  65. 478

    526

    Returns: 352804680

  66. 216

    157

    Returns: 37575372

  67. 961

    547

    Returns: 16678729680

  68. 728

    15

    Returns: 5771701796

  69. 595

    67

    Returns: 2567306280

  70. 586

    506

    Returns: 1753478712

  71. 30

    54

    Returns: 4

  72. 90

    56

    Returns: 1144290

  73. 759

    610

    Returns: 5418434670

  74. 168

    280

    Returns: 95004

  75. 195

    300

    Returns: 652740

  76. 396

    364

    Returns: 324530232

  77. 823

    399

    Returns: 9188555826

  78. 205

    358

    Returns: 70200

  79. 85

    1302

    Returns: 0

  80. 603

    1491

    Returns: 0

  81. 775

    1600

    Returns: 0

  82. 342

    699

    Returns: 0

  83. 642

    1301

    Returns: 0

  84. 514

    1175

    Returns: 0

  85. 158

    864

    Returns: 0

  86. 199

    783

    Returns: 0

  87. 5

    1189

    Returns: 0

  88. 833

    1687

    Returns: 0

  89. 378

    1555

    Returns: 0

  90. 509

    1929

    Returns: 0

  91. 158

    1982

    Returns: 0

  92. 433

    1013

    Returns: 0

  93. 898

    1875

    Returns: 0

  94. 999

    1

    Returns: 20543080502


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: