时间复杂度O(n)
1 long Fibonacci( long n ) 2 { 3 if( n <= 1 ) 4 return n; 5 6 long one=0; 7 long two=1; 8 9 for( long i = 2; i <= n; ++i ) 10 { 11 int tmp = two; 12 two += one; 13 one = tmp; 14 } 15 return two; 16 }