Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
|||||||||
2019-08-12 13:58:05
Use pi = 3.14 got WA, use pi = 3.141592654 and AC. |
|||||||||
2019-07-27 01:22:44
L^2/2*Phi |
|||||||||
2019-06-17 13:03:22
@sarthak_1998 man don't mislead others due to u i got one wa,use pi=3.1415926536 |
|||||||||
2019-05-25 19:50:35
Taking ur advice about PI=3.142 i got WA @sharthak_1998 Then used PI=2*acos(0.0) and AC |
|||||||||
2019-03-30 12:06:34
Taking the value of pi=3.142 and not as pi=3.14159 cost me two WAs |
|||||||||
2019-02-08 07:00:00
What is the use of such fence? |
|||||||||
2019-02-07 21:53:04
Just one basic geometry concept and than its too easy to implement! |
|||||||||
2019-01-01 18:59:19
In python 3 use: print("{0:.2f}".format(l*l/(2*pi))) Instead of: print(round(l*l/(2*pi),2)); |
|||||||||
2018-12-27 04:23:45
once you get the logic problem is super easy ac in one go |
|||||||||
2018-12-18 14:49:25
AC in one go!! |