-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAncientBerlandCircus.cpp
49 lines (42 loc) · 1.01 KB
/
AncientBerlandCircus.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
using namespace std;
int main()
{
double pi = 3.1415926;
double x1, y1, x2, y2, x3, y3;
cin >> x1 >> y1;
cin >> x2 >> y2;
cin >> x3 >> y3;
int v1x, v1y, v2x, v2y, v3x, v3y;
v1x = x1 - x2;
v1y = y1 - y2;
v2x = x2 - x3;
v2y = y2 - y3;
v3x = x1 - x3;
v3y = y1 - y3;
int l1 = v1x * v1x + v1y * v1y;
int l2 = v2x * v2x + v2y * v2y;
int l3 = v3x * v3x + v3y * v3y;
double alpha;
double len;
if (l1 == l2)
{
alpha = acos(-(v1x * v2x + v1y * v2y) / (sqrt(l1) * sqrt(l2)));
;
len = l1;
}
else if (l1 == l3)
{
alpha = acos((v1x * v3x + v1y * v3y) / (sqrt(l1) * sqrt(l3)));
len = l1;
}
else
{
alpha = acos((v2x * v3x + v2y * v3y) / (sqrt(l2) * sqrt(l3)));
len = l2;
}
alpha = max(pi - alpha, alpha);
double square = len / 2.0 * tan(alpha / 2) * pi / (pi - alpha);
printf("%.6f", square);
return 0;
}