Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Niko Goes Farming

By koushik · Limits 1s, 512 MB

Niko has completed his degree in CSE from North South University. Now he has been tenaciously looking for Software Engineering positions at various companies in Bangladesh. To his surprise, Niko was shocked to see how poorly Software Engineers in Bangladesh are paid. So, he has thought of an alternative career plan to start farming!

Well, before everything he plans to buy his own farmlands from North South Farmlands Agency (NSFA) which sells rectangular farmlands of any dimensions at the same price. So, the Agency has shown many farmlands and provided Niko with the perimeter of those lands. Now, Niko wants to find the maximum possible Area of each farmlands given their perimeter.

A perimeter of a rectangle is defined by the following formula:

Perimeter=(2×Length)+(2×Width)Perimeter = (2 \times Length) + (2 \times Width)


Input starts with an integer NN (1N1001 \le N \le 100), the number of farmlands. Each of the next NN lines will start with an integer PP (4P10004 \le P \le 1000), the perimeter of the farmland.


For each farmland, output a single number the maximum possible area of that land.



The test cases have been generated in a way that the answer will always be a whole number for this problem.



99% Solution Ratio

fire_tornadoEarliest, Apr '20

fire_tornadoFastest, 0.0s

fire_tornadoLightest, 0 B

bokaifShortest, 39B


Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.