码迷,mamicode.com
首页 >  
搜索关键字:求阶乘    ( 192个结果
POJ 1150-The Last Non-zero Digit(求阶乘最后一位非零数)
The Last Non-zero Digit Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1150 Appoint description:  System Crawler  (2015-03-30) ...
分类:其他好文   时间:2015-04-06 08:58:12    阅读次数:179
大数的阶乘的准确值
输入不超过1000的正整数你,输出其阶乘的准确的值。求阶乘大家都会,用递归就可以搞定,开销会比较大。阶乘增长是很快的,c语言中int值的范围大小与电脑位数n有关。整数区间为[-2^(n-1),2^(n-1))。在32位pc机上,其最大值为2^31,分析该题假如输入1000!是个很大的数,远远超过int的范围。可以用一个4000个元素的数组保存。从低位到高位依次保存在数组从小到大的角标元素中。代码如...
分类:其他好文   时间:2015-04-04 18:31:08    阅读次数:139
求阶乘位数1018
求一个数有N多少位,可用log10(N)+1,于是,求N!有多少位 log10(1*2*3*……*n)=log10(1)+log10(2)+……+log10(N)+1#include#includeusing namespace std;int main(){ int n,i,m,j; ...
分类:其他好文   时间:2015-04-02 20:29:30    阅读次数:118
Factorial Trailing Zeroes
这道题本质上是求阶乘中5的个数。还有一个公式即:[n/k]代表1~n中能被k整除的个数。class Solution{public: int trailingZeroes(int n) { int num= 0; while(n>0) { n...
分类:其他好文   时间:2015-03-08 14:07:24    阅读次数:107
SPOJ Problem 24:Small factorials
求阶乘,注意数据范围,要用高精。#include#includeint a[300];int n,x,y,l,i,j;int main(){ for (scanf("%d",&n);n--;){ scanf("%d",&x); memset(a,0,sizeof(a...
分类:其他好文   时间:2015-03-03 20:26:59    阅读次数:127
[持续更新]Python 技巧
本文以 Python 2.7 为基础。lambda 函数实现递归方法一:传递一个 self 参数求阶乘:1 frac = lambda self, x: self(self, x - 1) * x if x > 1 else 12 print frac(frac, 4)方法二(匿名函数也可以实现递归...
分类:编程语言   时间:2015-02-28 15:52:37    阅读次数:134
x86架构调用栈分析
以一个简单求阶乘的代码为例: 1 #include 2 3 unsigned int fact(unsigned int n) 4 { 5 if (n == 0) 6 return 1; 7 return n * fact(n - 1); 8 } 9 10 in...
分类:其他好文   时间:2015-02-17 22:16:01    阅读次数:257
python学习之---函数进阶
一,递归函数: 做程序应该都知道,在一个函数的内部还可以调用其它函数,这叫函数的调用,但是有一种特殊的情况,在一个函数内部对自身函数的调用,我们成这为函数的递归调用。在此,使用一个家喻户晓的例子来演示一下函数的递归调用------求阶乘:1 >>> func(1)2 13 >>> func(10)....
分类:编程语言   时间:2015-02-16 18:18:37    阅读次数:212
big number
//题意 求阶乘的位数。这么机智的做法肯定不是我自己想的o(╯□╰)oProblem DescriptionIn many applications very large integers numbers are required. Some of these applications are us...
分类:其他好文   时间:2015-02-02 12:11:59    阅读次数:204
c之求阶乘
#include #include int fact(int n) {     if(n==0)         return 0;     if(n==1)         return 1;     return n*fact(n-1); } int main() {     int n;     scanf("%d",&n);     printf("the ...
分类:其他好文   时间:2015-01-26 10:15:42    阅读次数:131
192条   上一页 1 ... 15 16 17 18 19 20 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!