输入格式:
输入在一行中给出一个不超过10000的正整数N。
输出格式:
在一行中输出兔子总数达到N最少需要的月数。
输入样例:
30
输出样例:
9
#include <stdio.h>
#include <iostream>
using namespace std;
int fib(int i)
{
if ((i == 1) || (i == 2))
return 1;
else
return fib(i - 1) + fib(i - 2);
}
int main()
{
int i = 1,n;
cin >> n;
while(fib(i) <= n){
i++;
}
cout << i << endl;
return 0;
}