【51nod 1028】 大数乘法 V2 【FFT/NTT】

【51nod 1028】 大数乘法 V2 【FFT/NTT】

FFT

AC代码。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<complex>
#define in_ inline
#define re_ return
#define op_ operator
#define tt_ template<typename x>
#define st_ static
#define inc(l, i, r) for(i=l; i<r; ++i)
typedef long long ll;
typedef double db;

const db eps=0.000001;
const ll mxn=300000;

ll c[mxn];
struct com
{
    db r, i;
    com(){r=i=0;}
    com(db a, db b){r=a, i=b;}
    tt_ in_ com op_*(x a)
        {re_ com(r*a, i*a);}
    in_ com op_*(com a)
        {re_ com(r*a.r-i*a.i, r*a.i+i*a.r);}
    tt_ in_ com op_+(x a)
        {re_ com(r+a, i);}
    in_ com op_+(com a)
        {re_ com(r+a.r, i+a.i);}
    tt_ in_ com& op_*=(x a)
        {re_ *this=*this*a;}
    tt_ in_ com& op_+=(x a)
        {re_ *this=*this+a;}
    tt_ in_ com& op_=(x a)
        {re_ *this=com(a, 0);}
} a[mxn], b[mxn];

struct io
{
    tt_ in_ io& op_& (x* a)
    {
        st_ ll c;
        for(;(c=getchar())<48||57<c;)
            if(c==EOF) re_ *this;
        for(;c>47&&58>c; c=getchar())
            *a++=c-48;
        *a=-1;
        re_ *this;
    }
    in_ io& op_| (char* s)
    {
        for(;*s; s++) putchar(*s);
        puts("");
        re_ *this;
    }
    in_ io& op_
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值