1021 : The Area of a Sector
Time Limit: 1 Sec Memory Limit: 128 MB Submitted: 1 Solved: 1 SpecialJudgeDescription
Given a circle and two points on it, calculate the area of the sector with its central angle no more than 180 degrees.
Input
There are multiple test cases.
Each line contains 6
float numbers denote the center of the circle xc, yc
, the two points on the circle x1, y1
and x2, y2
.
1 <= xc, yc, x1, y1, x2, y2 <= 10000
.
Output
The area of the sector. The result should be accurated to three decimal places.
Sample
0 0 1 1 -1 1 2.5 2.5 3.25 3.5 3.5 3.25
1.571 0.222
Hint
With math.h
, you could define pi
(3.1415926...
) as const double pi = acos(-1.0);
Inverse trigonometric function could be obtained by acos
, atan
, asin
, etc..
Be careful that angles like pi
in C/C++ are in 3.1415926...
type rather than 180
.
You’d better use double
instead of float
. Load double
with "%lf"
but output it with "%f"
.
Author
CSGrandeur