HUST Past Monthly Hard Problems Challenge Contest (1)

From: 2011-05-13 12:00:00 To: 2011-05-13 17:00:00 Now: 2017-09-20 01:08:43 Status: Public

A - Common area of two hearts

Time Limit: 1s Memory Limit: 128MB

Submissions: 34 Solved: 2
We define heart shape as follows: It is made up by a square and two semicircle.The length of the square’s side is l.And the diameter of semicicle is also l.The square’s sides are awalys make 45 degrees with x axes.And the corner (the lowest point of heart shape ) is awalys on the x axes. Now give you two heart shapes with the same size,your task is to determine the common area of the two hearts.
Two double number l (the length of the square’s side) and d (the distance of two hearts’ corners).
One double number:the common area of the two hearts rounded to 3 digits to the right of the decimal point.
Sample Input
100 200
Sample Output