hdu 2018 母牛的故事-LMLPHP

hdu 2018 母牛的故事-LMLPHP

#include<stdio.h>
int main(void)
{
int i,n,j,k;
long long narr[60];
narr[1]=1;
narr[2]=2;
narr[3]=3;
narr[4]=4;
narr[5]=6;
for(i=6; i<55; i++)
{
narr[i]=narr[i-1]+narr[i-3];
}
while(scanf("%d",&n)!=EOF,n)
{
printf("%lld\n",narr[n]);
}
return 0;
}

  

05-01 04:41