Cod sursa(job #1087505)
Utilizator | Data | 19 ianuarie 2014 15:10:04 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
long long P,s=0,j;
fin>>P;
if(!P)fout<<1;
else{
for(int i=5;i<=P;i+=5)
{ j=i;
while(j%5==0)
{
s++;
j/=5;
}
}
fout<<s;
}
return 0;
}