Cod sursa(job #1987544)
| Utilizator | Data | 31 mai 2017 00:05:38 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <fstream>
using namespace std;
int zero( int n ){
int z=0;
while ( n>=5 ){
if ( n%5==0 )
z++; n/=5;
}
return z;
}
int main()
{
ifstream in("fact.in");
ofstream out("fact.out");
long p; in>>p;
if( p==0 ) out<<1;
long sum=0;
for(int i=5; i<=p; i+=5 )
sum+=zero(i);
out<<sum;
return 0;
}
