-
Notifications
You must be signed in to change notification settings - Fork 27
/
177.cpp
103 lines (91 loc) · 3.1 KB
/
177.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#include "fmt/format.h"
#include <set>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
using namespace fmt;
namespace PE177 {
const double pi = acos(-1);
const double eps = 1e-9;
const int N = 200;
double X[N], Y[N];
struct node {
int v[8];
node(vector<int> h) {
for (int i = 0; i < 8; ++i)
v[i] = h[i];
}
};
bool operator < (node a, node b) {
for (int i = 0; i < 8; ++i)
if (a.v[i] != b.v[i])
return a.v[i] < b.v[i];
return false;
}
void generate(double *values, int T) {
for (int a = 1; a + T < 180; ++a) {
int b = 180 - a - T;
double v = sin(a * pi / 180) / sin(b * pi / 180);
values[a] = v;
}
}
node minimize(vector<int> h) {
node ret(h);
for (int c = 0; c < 2; ++c) {
for (int i = 0; i < 8; ++i) {
if (node(h) < ret)
ret = node(h);
rotate(h.begin(), h.begin() + 2, h.end());
}
reverse(h.begin(), h.end());
}
return ret;
}
void main() {
set<node> S;
int ans = 0;
for (int T = 1; T <= 90; ++T) {
if (T % 10 == 0)
print("{}\n", T);
generate(X, T);
generate(Y, 180 - T);
// if (T == 2) {
// printf("%.6f, %.6f\n", X[1], Y[1]);
// }
for (int a = 1; a + T < 180; ++a)
for (int b = 1; b < T; ++b)
for (int c = a; c + T < 180; ++c)
for (int d = 1; d < T; ++d) {
double v = X[a] * Y[b] * X[c] * Y[d];
if (-eps <= v - 1 && v - 1 <= eps) {
vector<int> h = {a, 180 - T - a, b, T - b, c, 180 - T - c, d, T - d};
node s = minimize(h);
if (S.count(s))
continue;
// print("({}, {}, {}, {}, {}, {}, {}, {}): {}\n", s.v[0], s.v[1], s.v[2], s.v[3], s.v[4], s.v[5], s.v[6], s.v[7], v);
ans += 1;
S.insert(s);
// for (int j = 0; j < 2; ++j) {
// for (int i = 0; i < 8; ++i) {
// rotate(h.begin(), h.begin() + 1, h.end());
// vector<int> x(h);
// S.insert(x);
// }
// reverse(h.begin(), h.end());
// }
}
}
}
print("{}\n", ans);
// for (auto h : S) {
// if (h[0] == 20 && h[1] == 50) {
// print("{}, {}, {}, {}, {}, {}, {}, {}\n", h[0], h[1], h[2], h[3], h[4], h[5], h[6], h[7]);
// }
// }
}
}
int main() {
PE177::main();
return 0;
}