/*
2.3基本算法之递归变递推_3525上台阶
http://noi.openjudge.cn/ch0203/3525/
1190:上台阶
http://ybt.ssoier.cn:8088/problem_show.php?pid=1190
3258:兔子产子
http://bailian.openjudge.cn/practice/3258/
*/
#include<cstdio>
long long d[110]= {0};
int main()
{
d[1]=1;
d[2]=2;
d[3]=4;
for(int i=4; i<=100; i++)
d[i]=d[i-1]+d[i-2]+d[i-3];
int a;
while(scanf("%d",&a)==1&&a)
printf("%lld\n",d[a]);
return 0;
}
/*
样例输入
1
2
3
4
0
样例输出
1
2
4
7
*/
2.3基本算法之递归变递推_3525上台阶
于 2021-12-23 20:01:14 首次发布