#C10967. Maximum Fenced Area
Maximum Fenced Area
Maximum Fenced Area
Jack manages his family farm and wants to build a rectangular fence using exactly N meters of fencing material. He wishes to obtain the maximum fenced area possible. It is a well known fact that, for a given perimeter, a square encloses the maximum area. Given an integer N, the task is to compute the area of the largest square that can be formed using an integer side length where each side is computed as \(\lfloor N/4 \rfloor\).
The answer for each test case should be printed in the format: Case i: area
, where i
is the test case number (starting from 1) and area
is the maximum possible area. Note that if N is not exactly divisible by 4, the side length is taken as the integer division result of \(N/4\) and the resulting fenced area is the square of that side length.
inputFormat
The first line of input contains a single integer T denoting the number of test cases. Each of the next T lines contains a single integer N representing the total meters of fencing material available.
outputFormat
For each test case, output a line in the format Case i: area
, where i
is the test case number starting from 1 and area
is the maximum area that can be fenced, computed as \( (\lfloor N/4 \rfloor)^2 \).
1
8
Case 1: 4
</p>