Maximize the volume of Cuboid
Submissions: 355   Accuracy:

32.39%

  Difficulty: Easy   Marks: 2

Given the sum of length, breadth and height of a cuboid. The task is to find the maximum volume that can be achieved such that the sum of sides is S.

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer S.

Output:
For each test case, print the maximum volume you can obtain in new line.

Constraints:
1 <= T <= 500
3 <= S < 10
6

Example:
Input:
2
4
8

Output:
2
18

Explanation:

Input : S = 8
Output : 18
All possible edge dimensions:
[1, 1, 6], volume = 6
[1, 2, 5], volume = 10
[1, 3, 4], volume = 12
[2, 2, 4], volume = 16
[2, 3, 3], volume = 18

** For More Input/Output Examples Use 'Expected Output' option **

Author: arun03


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.