TopcoderArchive
TCO9 Jan 2019
TCO19 SRM 751

Hyperbox

Problem statement, definition, constraints, and public examples.

Problem Statement

  • The boundary of a two-dimensional rectangle is one-dimensional (a collection of line segments), and we can measure its length.
  • The boundary of a three-dimensional box is two-dimensional (a collection of rectangles), and we can measure its area.
  • In the same sense, the boundary of a four-dimensional hyperbox is three-dimensional, and we can measure its volume.

You are given the int volume (in cubic meters). Return the number of distinct hyperboxes with positive integer sides (in meters) and this exact surface volume.

Two hyperboxes are distinct if they are not congruent. (In other words, they are distinct if we cannot rearrange the dimensions of one to get the dimensions of the other.)

Definition

Class:
Hyperbox
Method:
count
Parameters:
int
Returns:
int
Method signature:
int count(int volume)
(be sure your method is public)

Constraints

  • volume will be between 1 and 200,000,000, inclusive.

Examples

  1. 8
    Returns: 1
    The smallest possible hyperbox (i.e., the 1 x 1 x 1 x 1 hyperbox) is the only one with surface volume 8.
  2. 1234567
    Returns: 0
    There are no hyperboxes with integer sides and this exact surface volume.
  3. 120
    Returns: 3
    One of the three distinct hyperboxes with this surface volume has side lengths 1, 2, 2, and 7.
  4. 123456
    Returns: 52
Back to all problems