7 kyu
T.T.T.48: Make a rectangular cup that has maximum volume
133myjinxin2015
Description:
Description
We have a piece of cardboard square, side length is n
cm. We use it to make a cuboid cup(The five side is paper, one side is empty):
_____________________________
| |
| |
| |
| |
| |
| |
| |
|___________________________|
First we need to cut four identical small squares in the four corners of the cardboard.
_______________
cut | | cut
______| |______
| |
| |
| |
|______ _______|
| |
cut |_____________| cut
Then the four protruding part is folded upwards, a rectangular cup is made.
We can assume that the length of the small square is an integer. Please calculate, how much is the maximum volume of the cup we made?
Task
Complete function maximumVolume()
that accepts a arguments n
(a positive integer more than 4). Returns the maximum volume of the cup.
Example
maximumVolume(5) === 9
3 * 3 * 1 = 9
maximumVolume(6) === 16
4 * 4 * 1 = 16
maximumVolume(7) === 25
5 * 5 * 1 = 25
maximumVolume(8) === 36
6 * 6 * 1 = 36
maximumVolume(9) === 50
5 * 5 * 2 = 50
maximumVolume(10) === 72
6 * 6 * 2 = 72
maximumVolume(20) === 588
14 * 14 * 3 = 588
Puzzles
Games
Similar Kata:
Stats:
Created | Aug 25, 2016 |
Published | Aug 25, 2016 |
Warriors Trained | 285 |
Total Skips | 18 |
Total Code Submissions | 360 |
Total Times Completed | 133 |
JavaScript Completions | 133 |
Total Stars | 6 |
% of votes with a positive feedback rating | 89% of 47 |
Total "Very Satisfied" Votes | 40 |
Total "Somewhat Satisfied" Votes | 4 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |