爬楼梯

来源:互联网 发布:中文域名到期 编辑:程序博客网 时间:2024/06/09 16:40
#include<stdio.h>
long long f[95],n;
long long d(long long x){
 if(x==1)return 1;
 if(x==2)return 2;
 if(f[x]>0)return f[x];
 f[x]=d(x-1)+d(x-2);
 return f[x];
}
int main(){
 scanf("%d",&n);
 printf("%I64d\n",d(n));
 return 0;
}
0 0