int Fib1(int n)//递归
{
if (n <= 2)
return 1;
else
return Fib1(n - 2) + Fib1(n - 1);
}
int Fib2(int n)//循环
{
int a = 1, b = 1, c = 1;
while (n>2)
{
c = a + b;
a = b;
b = c;
n--;
}
return c;
}
#include <iostream>
using namespace std;
int main()
{
int n;
while (cin >> n)
cout << Fib2(n) << endl;
return 0;
}