//锤子系数的两种解法,递归和循环;本题中循环效率更高
//题目:求锤子系数:1 1 2 3 5 8 13.。。。。。
#include <stdio.h>
#include <stdlib.h>
int Fib1(int n)
{int a,b,c;//i对应第i个Fib系数
a=1;b=1;
while(n>2)//1 1 2 3 5 8 13
{
c=a+b;
a=b;
b=c;
n--;
}
return c;
}
int Fib2(int n)
{
if(n>2)
return Fib2(n-1)+Fib2(n-2);
else return 1;
}
int main()
{
int ret,n;
scanf("%d",&n);//
ret=Fib2(n);
printf("%d",ret);
system("pause");
return 0;
}