#include"iostream.h"
int n;
int cows(int x)
{
int t,i;
if(x>n-4)
return 0;
t=0;
i=x+4;
while(i<=n)
{
t=t+cows(i);
i++;
}
t+=n-x-3;
return t;
}
void main()
{
while(1)
{
cout<<"Input years";
cin>>n;
if(n==0)
break;
cout<<"cows number:"<<1+cows(1)<<endl;
}
}
评论0