FFT 高精度乘法

#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define MAXN 150005
char s[MAXN];
struct C
{
	double a,b;
	C(double _=0,double __=0) : a(_) , b(__)  { }
	friend C operator + (C x,C y){return C(x.a+y.a,x.b+y.b);}
	friend C operator - (C x, C y){return C(x.a-y.a,x.b-y.b);}
	friend C operator * (C x,C y){return C(x.a*y.a-x.b*y.b,x.a*y.b+x.b*y.a);}
}A[MAXN],B[MAXN];
#define pi 3.141592653589793238462
void FFT(C *x , int l,int on)
{
	int c=0,tmp=1; while(tmp=0){Ans[i+1]+=Ans[i]/10; Ans[i]=Ans[i]%10;}
		for(int i=l-1;i>=0;i--)
		if(Ans[i])
		{
			for(int j=i;j>=0;j--)putchar('0'+Ans[j]);
			putchar('\n');
			break;
		}
		else if(i==0)
		{
			putchar('0'); putchar('\n');
		}
	}
	return 0;
}

你可能感兴趣的:(FFT,模板)