阶乘后面0的数量

#include <bits/stdc++.h>
#define _xx ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin >> n;
    int k = 0, m = 5, ans = 0;
    while(m <= n) ans += n/m, m *= 5;
    cout << ans << endl;
    return 0;
}
View Code
原文地址:https://www.cnblogs.com/NWUACM/p/6891243.html