#K2966. Maximum Enclosed Area Adjacent to a River
Maximum Enclosed Area Adjacent to a River
Maximum Enclosed Area Adjacent to a River
You are given a total length ( L ) of fencing material. You need to construct a rectangular field adjacent to a river such that only three sides are fenced: the two sides parallel to the river (each of length ( x )) and the side perpendicular to the river (of length ( y )). The available fencing material is used to form the perimeter of these three sides, i.e., ( 2x + y = L ). The area of the field is given by ( A = x \times y ).
Your task is to determine the maximum area that can be enclosed using the available fencing material. By solving the optimization problem using calculus, the maximum area is achieved when ( x = \frac{L}{4} ) and ( y = \frac{L}{2} ), yielding a maximum area of ( \frac{L^2}{8} ).
Note that the division should be treated as integer division (i.e. floor division) so that the result is an integer.
inputFormat
Input consists of a single integer ( L ) read from standard input (stdin), where ( 1 \le L \le 10^9 ).
outputFormat
Output a single integer on standard output (stdout) representing the maximum area that can be enclosed using the given fencing material, computed as ( \lfloor \frac{L^2}{8} \rfloor ).## sample
50
312
</p>