#includeint fun(int x){ if(x==1) return 1; else if(x==2) return 2; else if(x==3) return 3; else return fun(x-1)+fun(x-3);}int main( ){ int N; while(scanf("%d",&N)!=EOF,N) printf("%d\n",fun(N)); return 0;}
本文共 288 字,大约阅读时间需要 1 分钟。
#includeint fun(int x){ if(x==1) return 1; else if(x==2) return 2; else if(x==3) return 3; else return fun(x-1)+fun(x-3);}int main( ){ int N; while(scanf("%d",&N)!=EOF,N) printf("%d\n",fun(N)); return 0;}
转载于:https://www.cnblogs.com/tangcong/archive/2011/04/28/2031921.html