thisisgoo吧 关注:15贴子:873
  • 0回复贴,共1
fft(a,n,flag)
for i= 0 to n-1 do if i<rev[i] then swap(a[i],a[rev[i]])
i=1
while i<n do
wn=cos(pi/i),sin(pi/i)*flag
j=0
while j<n do
w=1,0
for k= 0 to i-1 do
x=a[j+k] y=a[j+k+i]*w
a[j+k]=x+y a[j+k+1]=x-y
w=w*wn
j=j+2*i
i=i*2
if flag=-1 then
for i=0 to n-1 do a[i].r=a[i].r/n


IP属地:北京来自Android客户端1楼2016-07-23 23:56回复