#B3777. Cube Puzzle: Counting Blocks of a Rubik's Cube

    ID: 11434 Type: Default 1000ms 256MiB

Cube Puzzle: Counting Blocks of a Rubik's Cube

Cube Puzzle: Counting Blocks of a Rubik's Cube

Consider a standard Rubik's Cube of order \( n \) (with \( n \ge 2 \)). Each of its 6 faces is divided into \( n \times n \) smaller squares and is painted with a unique color. The small cubes formed by these painted squares are called pieces. Depending on how many of their faces are painted, the pieces are categorized as follows:

  • Corner Pieces: Each has 3 painted faces. There are always 8 corner pieces.
  • Edge Pieces: Each has 2 painted faces. The number of edge pieces is given by \( 12\times (n-2) \).
  • Center Pieces: Each has 1 painted face. Their count is \( 6\times (n-2)^2 \).

Given an integer \( n \), compute the number of corner pieces, edge pieces, and center pieces for a Rubik's Cube of order \( n \). Output the three numbers in the order: corner pieces, edge pieces, center pieces.

inputFormat

The input consists of a single integer \( n \) (\( n \ge 2 \)), representing the order of the Rubik's Cube.

outputFormat

Output three space-separated integers representing the number of corner pieces, edge pieces, and center pieces, respectively.

sample

2
8 0 0