172.[Leetcode]Factorial Trailing Zeroes
2016-05-17 13:08
429 查看
题意:
给一个数 n,计算n!的后面有几位0我的解法:
//计算其中有多少个5就可以了 class Solution { public: int trailingZeroes(int n) { int count(0); while(n/5 > 0){ n /= 5; count += n; } return count; } };
相关文章推荐
- HDU 5319 Painter
- HDU1151 Air Raid(有向图最小路径覆盖)
- LeetCode 220 Contains Duplicate III
- Codeforces Round #353 (Div. 2) B. Restoring Painting 水题
- From Opentsdb To Kairosdb
- 使用Genymotion调试出现错误INSTALL_FAILED_CPU_ABI_INCOMPATI
- async and await 简单的入门
- Tomcat启动报错 Failed to initialize connector [Connector[HTTP/1.1-8080]]
- Codeforces Round #353 (Div. 2)-B. Restoring Painting(数学)
- 详细解析Raid0、Raid0+1、Raid1、Raid5四者的区别
- Grails在服务类中获取web根目录
- Installation error: INSTALL_FAILED_UPDATE_INCOMPATIBLE
- 2016.5.16——leetcode:Rotate Array,Factorial Trailing Zeroe
- AEAI WM V1.5.0 升级说明,开源工作管理系统
- AEAI WM V1.5.0 升级说明,开源工作管理系统
- LeetCode 336. Palindrome Pairs
- 03-树3 Tree Traversals Again
- Failed to deploy virtual device -- Genymotion安装虚拟器失败
- sleep、yield、wait、join的区别
- Spirng+In+Action(Craig Walls Ryan Breidenbach)