#P5931. Maximum Shadow Length
Maximum Shadow Length
Maximum Shadow Length
Mildleopard, whose house is narrow and poorly lit, notices that the length of his shadow on the wall changes as he walks between the light bulb and the wall. One night, while pondering how to earn more money, he wonders what is the maximum length his shadow can attain.
Assume that when Mildleopard stands at a distance (x) from the light bulb, his shadow on the wall has a length given by the function
[
f(x) = x,(D - x),
]
where (D) is the distance between the light bulb and the wall, and (0 < x < D).
Using calculus it can be shown that the function (f(x)= x(D-x)) attains its maximum when (x = \frac{D}{2}). Substituting this value gives the maximum shadow length as
[
f_{\max} = \left(\frac{D}{2}\right)\left(D-\frac{D}{2}\right) = \frac{D^2}{4}.
]
Your task is to compute the maximum shadow length for a given distance (D).
inputFormat
The input contains one positive integer (D) ( (1 \leq D \leq 10^4) ), which represents the distance between the light bulb and the wall.
outputFormat
Output the maximum possible shadow length computed as (\frac{D^2}{4}). The answer should be a floating–point number. It is recommended to output the result with at least two digits after the decimal point.
sample
10
25.00