末尾0
2018-03-25 本文已影响3人
黑夜与繁星
image.png
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
scanf("%d",&n);
int cnt=0;
for(int i =5;i<=n;i+=5){
//cout<<"I"<<i<<endl;
int temp=i;
while(temp%5==0){
cnt++;
//cout<<"t"<<cnt<<endl;
temp/=5;
}
}
cout<<cnt;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, counter=0;
cin >> n;
while (n/=5)
{
counter += n;
}
cout << counter;
return 0;
}