#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;
}
2021-08-25 13:48:32
#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;
}