1
2
3
4
5
6
7
8
9
10
11
12
13
14
| // @Title: 阶乘后的零 (Factorial Trailing Zeroes)
// @Author: 15816537946@163.com
// @Date: 2022-03-25 19:29:04
// @Runtime: 0 ms
// @Memory: 1.9 MB
func trailingZeroes(n int) int {
var cnt int
for n > 0 {
cnt += n / 5
n /= 5
}
return cnt
}
|