#include<conio.h>
#include <iostream.h>
#include<iomanip.h>
long Compute1(int years) ;
#define Yes 1
#define No 0
long NumOfCow;
void main()
{
long year;
while(1)
{
cout<<"input year:(>=4)\n";
cin>>year;
NumOfCow=Compute1(year);
cout<<"母牛的总数是:"<<NumOfCow<<endl;
cout<<"继续么?"<<endl;
char c;
c=getch();
if(c=='n'||c=='N') break;
}
}
long Compute1(int years)
{
//初始化为1头牛
long count = 1;
if (years <= 3)
{
return count;
}
int i = 4;
while (i <= years)
{
int subYears = i - 3;
count += Compute1((int)(subYears));
i++;
}
return (long)count;
}