leetcode---Factorial Trailing Zeroes
2016-04-09 23:21
363 查看
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
Note: Your solution should be in logarithmic time complexity.
class Solution { public: int trailingZeroes(int n) { if(n == 0) return 0; int c5 = 0; while(n) { c5 += n/5; n /= 5; } return c5; } };
相关文章推荐
- beaglebone black xenomai移植 ---fwqlzz love is for ever
- Rails中scope和类方法的区别
- 【转】Condition的await-signal流程详解
- LeetCode *** 219. Contains Duplicate II
- InvalidateRect只是增加重绘区域,在下次WM_PAINT的时候才生效
- InvalidateRect只是增加重绘区域,在下次WM_PAINT的时候才生效
- 阿里云人工智能小Ai是比深度学习更高阶的算法
- http://blog.csdn.net/neiloid/article/details/7037093#
- HDOJ 2057 A + B Again
- kaili aircrack-ng remark
- pair<int, int> set<pair<int, int>>
- gem sources -a https://ruby.taobao.org/ 提示:Error fetching https://ruby.taobao.org/ SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: ce rtificate verify failed
- 2008 APAC local onsites Problem C. Millionaire
- aix 关闭报警黄灯
- 关于[[NSBundle mainBundle] infoDictionary]里面的那些东西
- NFS SERVER 引起aix系统无法启动
- leetcode196-Delete Duplicate Emails(删除重复并且id较大的数据)
- hdu1021 Fibonacci Again
- AIX双网卡绑定
- Conversion to Dalvik format failed with error 1