https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1003
找有几个5,几个25,几个125,。。。,直到一个都找不到,然后算每个5的贡献就好了。
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n, d = 5, ans = 0, cnt = 1;
cin >> n;
while (n / d != 0){
ans += n / d;
d *= 5;
++cnt;
}
cout << ans << endl;
return 0;
}