简单递推
吃糖果
http://www.nowcoder.com/questionTerminal/72015680c32b449899e81f1470836097
#include <stdio.h> int main(){ int n,i; while(scanf("%d",&n)!=EOF){ if(n==1) printf("1\n"); else if(n==2) printf("2\n"); else{ int a[n+1]; a[1]=1,a[2]=2; for(i=3;i<=n;i++) a[i]=a[i-1]+a[i-2]; printf("%d\n",a[n]); } } return 0; }(•̀ᴗ•́)و