【题目描述】
Your task is to calculate the number of trailing zeros in the factorial n!n!.
For example, 20!=243290200817664000020!=2432902008176640000 and it has 44 trailing zeros.
【输入】
The only input line has an integer nn.
【输出】
Print the number of trailing zeros in n!n!.
【输入样例】
20
【输出样例】
4
【提示】
1≤n≤109
#include<bits/stdc++.h>
using namespace std;
int main()
{
unsigned long long n;
cin>>n;
unsigned long long js2=0;
unsigned long long js5=0;
for(unsigned long long i=5;i<=n;i+=5){
int x=i;
while(x%5==0){
js5++;
x/=5;
}
}
cout<<js5;
return 0;
}