葉林
Linked with GitHub
# LeetCode - 0172. Factorial Trailing Zeroes ### 題目網址:https://leetcode.com/problems/factorial-trailing-zeroes/ ###### tags: `LeetCode` `Easy` `數學` ```cpp= /* -LeetCode format- Problem: 172. Factorial Trailing Zeroes Difficulty: Easy by Inversionpeter */ class Solution { public: int trailingZeroes(int n) { const int upperBound = (INT_MAX / 5); int fives = 0, base = 5; while (base <= n) { fives += n / base; if (base > upperBound) break; base = (base << 2) + base; } return fives; } }; ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up