黑马程序员—求1000!的结果末尾有多少个0 1000! = 1×2×3×4×5×...×999×1000
来源:互联网 发布:闲鱼卖家淘宝介入 编辑:程序博客网 时间:2024/05/22 09:01
------- <a href="http://www.itheima.com" target="blank">android培训</a>、<a href="http://www.itheima.com" target="blank">java培训</a>、期待与您交流! ----------
package two;
public class test {
private static int max = 1000;
public static int getFactor(int m)
{
int count = 0;
while(m%5 == 0)
{
count++;
if(m >= 5)
{
m = m / 5;
}
}
return count;
}
public static int getNumber()
{
int count_5 = 0;
for(int i = 1;i<=max;i++)
{
count_5 += getFactor(i);
}
return count_5;
}
public static void main(String[] args)
{
System.out.println("1*2*...*1000 有 "+test.getNumber()+"个0");
}
}
------- <a href="http://www.itheima.com" target="blank">android培训</a>、<a href="http://www.itheima.com" target="blank">java培训</a>、期待与您交流! ----------
- 黑马程序员—求1000!的结果末尾有多少个0 1000! = 1×2×3×4×5×...×999×1000
- 求1000!结果末尾有多少个0
- 黑马程序员——求1000!的结果中包含多少个0
- 黑马程序员——解题笔记(1)——求1000!的结果中包含多少个0
- 题目:1*2*3*……*100 求结果末尾有多少个零
- 1*2*3*……*100 求结果末尾有多少个零 网上的答案到底对不对
- 求1000!的结果中包含多少个0?注:1000! = 1×2×3×4×5×...×999×1000
- 、求1000!的结果中包含多少个0?注:1000! = 1×2×3×4×5×...×999×1000 *
- 求1000!的结果中包含多少个0?注:1000! = 1×2×3×4×5×...×999×1000(求阶乘)
- 求n!的结果末尾有多少0
- 1*2*...*1000的末尾有多少个0?(Java实现)
- 求N!末尾有多少个0
- 求N!末尾有多少个0
- 求n! 末尾有多少个0
- 求n!末尾有多少个0
- 求1000!的结果中包含多少个0
- n的阶乘结果中末尾有多少个零?
- N!的末尾有多少个0?
- iOS中的表情
- JDBC note
- 一个Demo小例子让你了解数据库连接池实现的4种方式
- Hibernate note
- HTML&CSS note
- 黑马程序员—求1000!的结果末尾有多少个0 1000! = 1×2×3×4×5×...×999×1000
- JavaScript note
- Win7 64位+Opencv247+VS2010配置 详细讲解
- 级联分类器训练
- Servlet note
- JSP note
- AJAX Note
- grep之字符串搜索算法Boyer-Moore由浅入深(比KMP快3-5倍)
- Android广告平台介绍