1,递归方法超时
2,int型存储溢出
3,Output Limit Exceeded错误
4,数学归纳法处理问题
#include<iostream>
#include<cstdio>
using namespace std;
unsigned long a[71];
int fun(int n)
{
for(int i=1;i<=n;i++)
if(i == 1)
a[i] = 1;
else if(i ==2)
a[i] = 2;
else
a[i] = a[i-1] + a[i-2];
return a[n];
}
int main()
{
int input;
while(scanf("%d",&input)!=EOF)
{
printf("%lu\n",fun(input));
}
return 1;
}