Submit | All submissions | Best solutions | Back to list |
LEAF - Leaf |
A leaf is inscribed in a square. Given the length of a side of the square. Find the area of the leaf.
A leaf is the intersection of two quarter circles drawn from two opposite ends of a square, with the radius being equal to the length of a side of the square.
Input
In the first line there will be an integer t (t ≤ 105) the number of testcases. Next t lines will contain a number a (0 ≤ a ≤ 106), the side length of the square.
Output
Print the area of the Leaf. Errors less than 10-6 will be ignored.
Example
Input: 2
1
2
Output: 0.5707963268
2.2831853072
Added by: | Rezwan |
Date: | 2016-05-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
hide comments
|
||||||
2016-05-16 17:54:04 [Rampage] Blue.Mary
My "AC" program uses double directly, which is obviously wrong. "AC" program output "570796326794.8966064453" for case with L=1000000 too, which should be ".896619..." after floating point. Last edit: 2016-05-16 17:55:27 |
||||||
2016-05-16 12:31:24 Francky
Assume True = True Seriously, if the judge isn't changed, as BlueMary ever mentionned, then the problem should be hidden ! pstetter should solve more problems about floats, and read carefully comments from valuable psolver like BlueMay. |
||||||
2016-05-16 11:08:21
@kapslocker Write cout<<steprecision(20)<<fixed<< ............... ; ________________________________^^^^^_____________ In cpp, if you directly write cout<< /* you equation */ , it will give you WA in many Online-judges. Better store the value in a separate variable and then print it. It will give you AC. I know they both means same .... But somehow it fixes the problem... I also got many times WA in many Judges for writing directly ... But when I store value and then print.... Somehow it gets AC. :) Last edit: 2016-05-16 11:08:54 |
||||||
2016-05-16 10:53:44
Almost everyone is missing a little thing... ans getting WA.... Please read the Input section carefully... |
||||||
2016-05-16 10:50:25
@dips88 Your formula is going wrong. ! |
||||||
2016-05-16 07:20:32 sharad mahajan
1 1000000 570796326794.8966064453 got ac.. use pi=acos(-1) |
||||||
2016-05-15 16:29:25
Keeps giving WA in cpp. Using double wherever possible and pi = 2*acos(0). My output for 1000000 is 570796326794.89660645 . There is nothing wrong with the formula, dunno where I am going wrong. Please help. The answer changes with long double, please look into it. |
||||||
2016-05-15 12:51:42
@Rezwan please check this one16920909 getting wrong answer wgile getting correct ans in dev c++. |
||||||
2016-05-14 19:49:46 [Rampage] Blue.Mary
As I mentioned before, you may change judge to a self-constructed judge "Ignore absolute or relative error less than 10^-9"(and not change test data), or use a high-precision program as std program (and change test data accordingly). Using double is obviously not the case. |
||||||
2016-05-14 19:12:04
@Rampage C++ double gets AC. Now What can I do? |