题解 | #吃糖果#
吃糖果
https://www.nowcoder.com/practice/72015680c32b449899e81f1470836097
#include <stdio.h> int func(int n){ if(n==1) return 1; else if(n==2) return 2; else return func(n-1)+func(n-2); } int main() { int a; while (scanf("%d", &a) != EOF) { printf("%d\n",func(a)); } return 0; }