Count the Number of Cubes with Paint On
Submit solution
Points:
1
Time limit:
2.0s
Memory limit:
256M
Problem types
Allowed languages
Python
A large cube is painted red on the outside.
The cube is then cut the same number of times along each dimension.
If there is 1 cut along each dimension, the cube becomes 2 by 2 by 2.
If there are 2 cuts along each dimension, the cube becomes 3 by 3 by 3.
Write a program that reads the number of cuts and prints how many smaller cubes have at least one painted face.
If there are 0 cuts, there is still one cube, and it has painted faces.
Input
The input contains one integer, cuts.
Output
Output the number of smaller cubes that have at least one painted face.
Sample Input
2
Sample Output
26
Comments