FENCE1 - Build a Fence


There is a wall in your backyard. It is so long that you can’t see its endpoints. You want to build a fence of length L such that the area enclosed between the wall and the fence is maximized. The fence can be of arbitrary shape, but only its two endpoints may touch the wall.

Input

The input consists of several test cases.

For every test case, there is only one integer L (1<=L<=100), indicating the length of the fence.

The input ends with L=0.

Output

For each test case, output one line containing the largest area. Your answer should be rounded to 2 digits after the decimal point.

Example

Input:
1
0

Output:
0.16

hide comments
mpride44: 2017-12-23 08:39:57


consider a wall as a rod now u tied one end of this rod to the fence(or say thread)
and another end of the fence to another end of the rod because only two endpoints can touch the wall(or rod), the figure u get has max area...n no doubt figure is semicircle..
use double as input, and use formula (l*l/pi)/2,
pi=3.14159

Last edit: 2017-12-23 08:40:36
sophozaar: 2017-12-15 18:00:51

Take complete value of PI = 3.14159 and not PI = 3.14.

sgarg367: 2017-12-09 06:33:23

which rounding off technique is it accepting ?

amitboss: 2017-12-05 15:32:20

i think there is a problem in it , if u round off 3.325 and 3.315 , both will be 3.32 according to standard rounding off rule , but in this problem ,it is accepting 3.33(wrong) and 3.315(right), , check it .

prasanth292130: 2017-09-02 20:38:16

AC in a go!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

vikas_mundra: 2017-06-27 08:53:36

AC in one go!!use fixed and setpresicion for c+++

sagnik_66: 2017-05-20 08:55:12

AC in one go! Easy :-)

rohit9934: 2017-05-06 07:55:35

Take input as double, it cost me a lot of WAs.Output=(L*L/PI)/2 . Take PI as 3.14159

shauryauppal: 2017-04-12 18:09:46

perimeter=Pi*r and area=(Pi*r^2)/2

Last edit: 2017-04-12 18:12:02
rajeev_899: 2017-03-02 20:39:35

My 100th :)


Added by:Fudan University Problem Setters
Date:2009-05-23
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: C99 ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Fudan University Local Contest #1, practise session