#include <stdio.h> typedef struct stack{ int num; }stack ; int main() { int n; while (scanf("%d ", &n) != EOF) { if(n==1){printf("1\n");continue;} if(n==2){ printf("2\n");continue;; } int a[n+1];//用n表示索引为n的楼层有几种走法 a[0]=1; a[1]=1;a[2]=2; for(int i=3;i<n+1;i++){ a[i]=a[i-1]+a[i-2]; } printf("%d\n",a[n]); } return 0; }