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
r210397: 2018-06-26 20:54:40

why round is'nt working with python

Piotrek Nicowski: 2018-05-08 15:34:17

I have an awful problem with this task in Java. For those who strugle with this task:
- for input 7 output should be 7.80 (NOT 7.8)
- for input 17 output should be 46.00 (NOT 46)

ash_maurya: 2018-03-20 21:56:45

Implementation is easy. The only trick here is in precision. For C++, use fixed setprecision(2).

kkislay20: 2018-03-10 18:47:51

Implementation is too easy if you get it.

ayusofayush: 2018-02-17 06:22:05

use pi=3.14159 and use setprecision() in c++

shashankpathak: 2018-02-16 21:00:28

i used value of pi=3.1415926 it gave the AC while for 22.00/7.00 it was giving WA why so ??

venkat016: 2018-01-10 21:15:56

Thanks to @ajayc1007 and @prasad_235 for the logic

gokulmit: 2018-01-10 07:31:23

round off using %.2f in c. cout.percision caused a wa

vkash: 2018-01-01 14:54:49

AC in one Go..just 1 line of code...!!

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

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