2.3基本算法之递归变递推_3525上台阶
生活随笔
收集整理的這篇文章主要介紹了
2.3基本算法之递归变递推_3525上台阶
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
http://ybt.ssoier.cn:8088/problem_show.php?pid=1190
/* 2.3基本算法之遞歸變遞推_3525上臺階 http://noi.openjudge.cn/ch0203/3525/1190:上臺階 http://ybt.ssoier.cn:8088/problem_show.php?pid=1190 */ #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; }?
?
?
?
?
?
?
?
?
?
總結(jié)
以上是生活随笔為你收集整理的2.3基本算法之递归变递推_3525上台阶的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第41课 蜗牛与葡萄树 《小学生C++趣
- 下一篇: 【java基础】idea配置jdk环境,