172 Factorial Trailing Zeroes
2015-08-11 15:00
375 查看
/*
* 解题要点:
* (1) 任何数都能分解成质数相乘的形式,末尾零的个数由质数2和5的质数的个数决定
* (2)质数2的个数一定大于5的个数
*/
class Solution {
public int trailingZeroes(int n) {
int res = 0;
while(n > 0){
res += (n/5);
n /= 5;
}
return res;
}
}
* 解题要点:
* (1) 任何数都能分解成质数相乘的形式,末尾零的个数由质数2和5的质数的个数决定
* (2)质数2的个数一定大于5的个数
*/
class Solution {
public int trailingZeroes(int n) {
int res = 0;
while(n > 0){
res += (n/5);
n /= 5;
}
return res;
}
}
相关文章推荐
- HDU 1532 Drainage Ditches
- SmtpClient发邮件时为什么用MailMessage.From而不用MailMessage.Sender
- MDK __main过程分析
- 树形DP - hdu5293 Tree chain problem
- HDU - 4630 No Pain No Game (线段树 + 离线处理)
- Binder与AIDL服务
- **深入浅出的事件路由(view hit test)**
- leetCode #217 Contains Duplicate
- HDU 4819 Mosaic D区段树
- sleep和wait区别
- windows 2012 R2 DHCP FailOver
- commons-mail报错,提示EmailException: Sending the email to the following server failed
- 不依赖sendmail和postfix发邮件
- HDU 1082 Matrix Chain Multiplication
- 《实体解析与信息质量》 - 3.1.3 Algebraic模型
- mdadm彻底删除software RAID
- GenyMotion报错An error occured while deploying a file.INSTALL_FAILED_INVALID_URI
- UVa 12878 - Flowery Trails(最短路应用)
- Air Raid
- saiku安装方法总结