#include <cstdio> #include <iostream> using namespace std; const int maxn=91; int main() { long long f[maxn]={0}; int n; f[1]=1; f[2]=2; while(scanf("%d",&n)!=EOF){ if(n==1) printf("1\n"); else if(n==2) printf("2\n"); else{ //递推思想:假设有n阶楼梯,对应上楼方式有f[n]种. //则n阶楼梯可由共走n-1阶楼梯后再走1阶,或者共走n-2阶楼梯后再走2阶方式组成. //则f(n)=f(n-1)+f(n-2) for(int i=3;i<=n;i++) f[i]=f[i-1]+f[i-2]; printf("%lld\n",f[n]); } } return 0; }