At your neighbourhood Halloween party, appropriately named The Ninth Triangle of the Underworld
, you've decided to play a fun game! Two witch hats are placed on conveyor belts moving in opposite directions. For simplicity, we can imagine the witch hats as triangles, with their bases on the same line parallel to the
You are asked to throw a ball at the witch hats and will win a prize if you hit either one of them. To make your life more difficult, you will only be told the side lengths of the triangles and will not be told the orientation of the witch hats. In addition, you will not be told when to throw the ball at the targets.
You want to know what is the smallest target area you could possibly be facing when you throw the ball. The target area is the area of the union of the two triangles at their current locations.
Constraints
Input Specification
The first line of input contains
The second line of input contains
Output Specification
This problem is graded with a custom checker.
Output, on a single line, the smallest target area you could possibly be facing when you throw the ball at the witch hats. Ensure this line is terminated with a \n
character and has no leading nor trailing spaces.
Your answer will be considered correct if it has an absolute or relative error of at most
Sample Input
8 5 5
6 6 6
Sample Output
16.9112382237
Comments
I used numerical method in C++11 and get AC, but get WA in test case 3 after adding #pragma GCC optimize "Ofast" to enable optimization.
Unfortunately, C++ will sometimes try to take shortcuts when optimizing code. This can sometimes result in floating point inaccuracies.