![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
递归
xiaosha_
不想做咸鱼……努力挣扎……
展开
-
计算一个数字由斐波那契数列组成的个数
我好像将博客当成微博写了…………#include #include using namespace std;const int size = 44;int fib[size];int vist[size];//可以组成的数字 int sum[size];int count =0;void f(int n,int m){ int cnt=0; if(n==0){// fo原创 2017-03-26 14:34:31 · 1066 阅读 · 0 评论 -
阶乘末尾0的个数 ( 1308 )
当阶乘比较的时候,我们如果采用一步步计算除10取余数来计算0的个数,无疑是比较不切实际的,以下采用计算整个过程中5出现的个数来统计阶乘0的个数,极大减小了算法的时间复杂度我的代码是看的别人的 就当转载了#include using namespace std;int f(int n){ if(n == 0) return 0; return n/5 + f(n/5);}转载 2017-03-26 14:41:07 · 340 阅读 · 0 评论