-
Notifications
You must be signed in to change notification settings - Fork 27
/
152.cpp
52 lines (46 loc) · 1.04 KB
/
152.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
#include <cstdio>
#include <map>
using namespace std;
const int n = 80, m = 64 * 27 * 25 * 7 * 11 * 13;
int top;
long long Q[n], ans;
int o[n];
map<long long, int> F;
void dfs(int b, int L, int R, long long sum) {
if (L > R) {
if (b) {
if (F.count(sum) == 0)
F[sum] = 1;
else
++F[sum];
} else {
sum = 1ll * m * m / 2 - sum;
if (F.count(sum)) {
printf("new: ");
for (int i = top / 2 + 1; i <= top; ++i)
if (o[i] == 1 && 1ll * m * m / Q[i] % 13 == 0) {
printf("%lld ", 1ll * m * m / Q[i]);
}
printf("\n");
ans += F[sum];
}
}
return ;
}
o[L] = 0, dfs(b, L + 1, R, sum );
o[L] = 1, dfs(b, L + 1, R, sum + Q[L]);
}
int main() {
for (int i = 2; i <= n; ++i) {
if (m % i == 0) {
++top;
Q[top] = 1ll * (m / i) * (m / i);
}
}
printf("m = %d, top = %d\n", m, top);
dfs(1, 1, top / 2, 0);
printf("F.size = %d\n", (int)F.size());
dfs(0, top / 2 + 1, top, 0);
printf("ans = %lld\n", ans);
return 0;
}