【FFT加速特征多项式解线性递推】hdu4914

上一篇http://blog.csdn.net/huyuncong/article/details/18184873

虽然是FFT加速,但其实这道题限制挺强的,首先特征多形式的次数虽然上万,但是递推式只涉及到2项,因此初项其实可以线性推出,而且模很小只有119,因此FFT中不用取模,可以先算完再取模。

复杂度o(klogklogn)

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
const double pi = acos(-1.0);
const int maxn = 1 << 18;
const int mo=119;
struct Complex {
    double x, y;

    Complex (double real = 0, double imag = 0) : x(real), y(imag) {}

    double &real() {
        return x;
    }

    double &imag() {
        return y;
    }
    
    void print()
    {
        cout<<"real="<<x<<" imag=%.7lf\n"<<y<<endl;
    }
}Pa[50000],Pb[50000],Pc[50000];
int f[50000];
int n,a,b,p,q,N;
Complex operator+(const Complex &
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值