You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <cstdio>
|
|
using namespace std;
|
|
int a[60];
|
|
int main()
|
|
{
|
|
a[1]=1,a[2]=2,a[3]=3;
|
|
for(int i=4;i<60;i++)
|
|
a[i]=a[i-1]+a[i-3];
|
|
int n;
|
|
while(scanf("%d",&n),n)
|
|
printf("%d\n",a[n]);
|
|
return 0;
|
|
}
|