class Solution { public: int Fibonacci(int n) { //动态规划 int n1 = 0, n2 = 1; while(--n){ n2 = n1 + n2; n1 = n2 - n1; } return n2; } };