JDCC '16 Contest 2 P5 - Supermoon Viewing

View as PDF

Submit solution

Points: 12
Time limit: 2.0s
Memory limit: 64M

Problem types

Recently, the moon has passed closer to the Earth than it has in decades. Hazel, set on seizing the opportunity, stayed up all night to watch the moon through her circular window. Unfortunately, the moon and Hazel's window did not perfectly align, and Hazel could only see part of the moon. Can you figure out how much of the moon she saw?


Each test case begins with three integers X_w, Y_w, R_w (1 \le X_w, Y_w, R_w \le 1 000), representing a circle centered at (X_w, Y_w) with radius R_w, the part of the sky that she could see through her window.

The next line contains three integers X_m, Y_m, R_m (1 \le X_m, Y_m, R_m \le 1 000), the position of the moon in the sky.


For each test case, output the area of the moon that was visible. Your answer will be counted as correct if it is within a relative or absolute error of 10^{-4} from the judge's answer.

Sample Input

1 1 2
1 1 1

Sample Output


Sample Input

1 2 1
1 1 1

Sample Output



There are no comments at the moment.