Cube Change
Practice
3.2 (272 votes)
Approved
Easy
Math
Ready
Sorting
Problem
40% Success 12061 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Chandan gave his son a cube with side N. The N X N X N cube is made up of small 1 X 1 X 1 cubes.

Chandan's son is extremely notorious just like him. So he dropped the cube inside a tank filled with Coke. The cube got totally immersed in that tank. His son was somehow able to take out the cube from the tank. But sooner his son realized that the cube had gone all dirty because of the coke. Since Chandan did not like dirty stuffs so his son decided to scrap off all the smaller cubes that got dirty in the process. A cube that had coke on any one of its six faces was considered to be dirty and scrapped off. After completing this cumbersome part his son decided to calculate volume of the scrapped off material. Since Chandan's son is weak in maths he is unable to do it alone.

Help him in calculating the required volume.

Input:

The first line contains T denoting the number of test cases. Then T lines follow each line contains N that is the side of cube.

Output:

For each case output the required volume.

Constraints:

  • 1 ≤ T ≤ 100
  • 1 ≤ N ≤ 109

Note:

There is no hole or space between 2 smaller cubes.

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
19 votes
Tags:
ApprovedData StructuresEasyOpenSorting
Points:20
15 votes
Tags:
EasyMathSorting