原问题:
代码:
void solve() {
ll i, j, k, p, q, u, v, l, r, x, y, z, z1;
z = 0;
double a, b, c;
N = 1e9;
n = 250250;
p = 1e16;
z = 250;
for (i = 1; i <= n; i++) {
C[i]= M.NT.prime_pow(i, i, z);
}
A[0] = 1;
for (i = 1; i <= n; i++) {
x = C[i];
for (j = 0; j < z; j++) {
B[ (x + j)%z ] = B[(x + j) % z] + A[j];
}
for (j = 0; j < z; j++) {
A[j] = A[j] + B[j];
A[j] = A[j] % p;
B[j] = 0;
}
}
printf("%lld\n", A[0]-1);
}