0_0_36706366_26824.cpp: In function 'void FFT(Complex*, int, int)':
0_0_36706366_26824.cpp:47:8: error: 'x' was not declared in this scope
= MOD) x -= MOD; } void mul(int *tmp1, int *tmp2, int maxn) { //for(int i = 0;i < q; i++) printf("%d ", tmp1[i]); puts(""); //for(int i = 0;i < q; i++) printf("%d ", tmp2[i]); puts(""); for(int i = 0;i < maxn; i++) { a1[i].x = a1[i].y = a2[i].x = a2[i].y = 0; if(i < q) { a1[i].x = 1.0*tmp1[i]; a2[i].x = 1.0*tmp2[i]; } } FFT(a1, maxn, 1); FFT(a2, maxn, 1); for(int i = 0;i < maxn; i++) a1[i] = a1[i]*a2[i]; FFT(a1, maxn, -1); for(int i = 0;i < maxn; i++) Fuck[i] = (ll)(a1[i].x+eps)%MOD; for(int i = q*2-2;i >= q; i--) { if(Fuck[i]) { Fuck[i-q] = (Fuck[i-q] + Fuck[i]*b)%MOD; Fuck[i-p] = (Fuck[i-p] + Fuck[i]*a)%MOD; } } //printf("q = %d\n", q); for(int i = 0;i < q; i++) { tmp1[i] = (int)Fuck[i]; } } int ans[N], tmp[N], f[N]; int solve() { a %= MOD; b %= MOD; f[0] = 1; for(int i = 1;i < q; i++) { if(i-p < 0) f[i] = a+b; else if(i < q) f[i] = (a*f[i-p]+b)%MOD; } if(n < q) { return f[n]; } int maxn = 1; while(maxn <= (q-1)*2) maxn <<= 1; for(int i = 0;i < q; i++) ans[i] = tmp[i] = 0; ans[0] = 1; tmp[1] = 1; int fuck = n; while(n) { if(n&1) { mul(ans, tmp, maxn); } mul(tmp, tmp, maxn); n >>= 1; } int ret = 0; for(int i = 0;i < q; i++) { Add(ret, ans[i]*f[i]%MOD); } n = fuck; return ret; } int main() { while(input()) { printf("%d\n", solve()); } return 0; }
^
0_0_36706366_26824.cpp:47:61: error: a function-definition is not allowed here before '{' token
= MOD) x -= MOD; } void mul(int *tmp1, int *tmp2, int maxn) { //for(int i = 0;i < q; i++) printf("%d ", tmp1[i]); puts(""); //for(int i = 0;i < q; i++) printf("%d ", tmp2[i]); puts(""); for(int i = 0;i < maxn; i++) { a1[i].x = a1[i].y = a2[i].x = a2[i].y = 0; if(i < q) { a1[i].x = 1.0*tmp1[i]; a2[i].x = 1.0*tmp2[i]; } } FFT(a1, maxn, 1); FFT(a2, maxn, 1); for(int i = 0;i < maxn; i++) a1[i] = a1[i]*a2[i]; FFT(a1, maxn, -1); for(int i = 0;i < maxn; i++) Fuck[i] = (ll)(a1[i].x+eps)%MOD; for(int i = q*2-2;i >= q; i--) { if(Fuck[i]) { Fuck[i-q] = (Fuck[i-q] + Fuck[i]*b)%MOD; Fuck[i-p] = (Fuck[i-p] + Fuck[i]*a)%MOD; } } //printf("q = %d\n", q); for(int i = 0;i < q; i++) { tmp1[i] = (int)Fuck[i]; } } int ans[N], tmp[N], f[N]; int solve() { a %= MOD; b %= MOD; f[0] = 1; for(int i = 1;i < q; i++) { if(i-p < 0) f[i] = a+b; else if(i < q) f[i] = (a*f[i-p]+b)%MOD; } if(n < q) { return f[n]; } int maxn = 1; while(maxn <= (q-1)*2) maxn <<= 1; for(int i = 0;i < q; i++) ans[i] = tmp[i] = 0; ans[0] = 1; tmp[1] = 1; int fuck = n; while(n) { if(n&1) { mul(ans, tmp, maxn); } mul(tmp, tmp, maxn); n >>= 1; } int ret = 0; for(int i = 0;i < q; i++) { Add(ret, ans[i]*f[i]%MOD); } n = fuck; return ret; } int main() { while(input()) { printf("%d\n", solve()); } return 0; }
^
0_0_36706366_26824.cpp:47:61: error: expected '}' at end of input
|