Statistics

Problem Statement for "TicTacToe3D"

Problem Statement

Given n, return the number of distinct ways to put n X's on an n by n by n 3-D Tic Tac Toe Board such that the n X's are in a row.

The n in a row can be in a horizontal, vertical, or diagonal line.

Definition

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

Constraints

  • n will be between 1 and 1000, inclusive.

Examples

  1. 1

    Returns: 1

    There is only one possible place to put the X, and it results in getting 1 in a row, so there is 1 way to get 1 in a row.

  2. 2

    Returns: 28

  3. 8

    Returns: 244

  4. 500

    Returns: 753004

  5. 1000

    Returns: 3006004

  6. 40

    Returns: 5044

  7. 20

    Returns: 1324

  8. 23

    Returns: 1729

  9. 43

    Returns: 5809

  10. 998

    Returns: 2994004

  11. 456

    Returns: 626548

  12. 35

    Returns: 3889

  13. 543

    Returns: 887809

  14. 345

    Returns: 359149

  15. 341

    Returns: 350893

  16. 12

    Returns: 508

  17. 787

    Returns: 1862833

  18. 456

    Returns: 626548

  19. 745

    Returns: 1669549

  20. 654

    Returns: 1287076

  21. 1

    Returns: 1

  22. 8

    Returns: 244

  23. 3

    Returns: 49

  24. 2

    Returns: 28

  25. 5

    Returns: 109


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: