题目链接:
题意:
让你求两个大数的乘法。
题解:
FFT裸题。
FFT学习推荐:
1 #include2 #define F(i,a,b) for(int i=a;i<=b;++i) 3 using namespace std; 4 5 const double pi=acos(-1.0); 6 //n 必须为 2 的幂。 7 struct comp{ 8 double r,i; 9 comp(double _r=0,double _i=0){r=_r,i=_i;}10 comp operator+(const comp x){ return comp(r+x.r,i+x.i);}11 comp operator-(const comp x){ return comp(r-x.r,i-x.i);}12 comp operator*(const comp x){ return comp(r*x.r-i*x.i,r*x.i+i*x.r);}13 };14 15 void FFT(comp a[],int n,int t){16 for(int i=1,j=0;i >=1,~j&s;);19 if(i 0)n--;72 for(int i=n;i>=0;i--)printf("%c",sum[i]+'0');73 puts("");74 }75 return 0;76 }