hdu-2018-母牛的故事

#include
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;


int func(int x)
{
if(x==1)  return 1;
if(x==2)  return 2;
if(x==3)  return 3;
if(x==4)  return 4;
return func(x-1)+func(x-3);
}
int main()
{
      int n;
  while(scanf("%d",&n)!=EOF)
  {
  if(!n)  break;
  printf("%d\n",func(n));
 }
 return 0;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章