Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
改进乘法复杂度的常数因子(乘法计算减少一半),还是无法过, 期待指点,,,In Reply To:据我搜索资料,发现最快的就是FFT了。 也许你的算法效率问题不在那儿~ 呵呵~~纯属猜测。 期待牛人回复~~ Posted by:411465294 at 2007-12-02 22:44:00 int myMulti(unsigned long *a, int len_a, unsigned long *c) { int i=0, j=0; unsigned long step=0; __int64 h=0; unsigned long *p_h=(unsigned long *)&h; memset(c, 0, sizeof(unsigned long)*(len_a<<1)); for(i=0; i<len_a; i++) { step=0; h=(__int64)a[i]*a[i]+c[i<<1]+step; unsigned long temp=(p_h[0]>>base); step=(p_h[1]<<(32-base))+temp; c[i<<1]=(p_h[0]-(temp<<base)); for(j=i+1; j<len_a; j++) { h=(__int64)a[i]*(a[j]<<1)+c[i+j]+step; temp=(p_h[0]>>base); step=(p_h[1]<<(32-base))+temp; c[i+j]=(p_h[0]-(temp<<base)); } c[(j++)+i]=step; } return i+j-1; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator