TopcoderArchiveVisit Topcoder
SRM26 Nov 2002
SRM 121

TicTacToe3D

Problem statement, definition, constraints, and public examples.

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. 8
    Returns: 244
  3. 500
    Returns: 753004
Back to all problems