The moon has been opened up, and land can be obtained for free, but there is a catch. You have to build a wall around the land that you stake out, and building a wall on the moon is expensive. Every country has been allotted a by square area, but they will possess only that area which they wall in. posts have been placed in a rectangular grid with meter spacing. The wall must be a closed series of straight lines, each line running from post to post.
The bigger countries of course have built a wall enclosing the entire area. The Duchy of Grand Fenwick, has a tighter budget, and has asked you (their Royal Programmer) to compute what shape would get best maximum enclosed-area/wall-length ratio.
You have done some preliminary calculations on a sheet of paper.
For a meter wall enclosing the area the
enclosed-area/wall-length ratio is .
Although not allowed , but to get an idea if this is anything better: if you place a circle inside the square area touching the four sides the area will be equal to and the perimeter will be , so the enclosed-area/wall-length ratio will also be .
However, if you cut off from the square four triangles with sides , and the total area becomes and the perimeter becomes . So this gives an enclosed-area/wall-length ratio of , which is significantly better.
Find the maximum enclosed-area/wall-length ratio.
Give your answer rounded to places behind the decimal point in the form abc.defghijk.
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.