现在的位置: 首页 > 综合 > 正文

母牛的故事

2013年04月16日 ⁄ 综合 ⁄ 共 189字 ⁄ 字号 评论关闭
#include<stdio.h>
int 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;
}
 

抱歉!评论已关闭.