斐波纳奇数列:
定义为F0=0,F1=1,......Fn=F(n-1)+F(n-2)
1,1,2,3,5,8,13,21,34,55.......
void FibonacciOdd(int n) { int prev_1 = 0, prev_2 = 0, item = 0; for(int i=0;i<=n;i++) { if(i==0) item = 0; else if(i==1) { item = pre1 = 1; } else { item = prev_1 + prev_2; pre_2 = pre_1; pre_1 = item; } //cout<<"第"<<i<<"项"<<item<<endl; } }