Cod sursa(job #292551)
Utilizator | Data | 31 martie 2009 11:40:00 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<fstream.h>
main()
{long p,n=0,cont=1,c;
ifstream i("fact.in");
ofstream o("fact.out");
i>>p;
while(cont<p)
{n=n+5;c=cont;
while(c%5==0)
{cont++;c/=5;}
cont++;
}
if(cont==p)
o<<n<<'\n';
else
o<<"-1"<<'\n';
i.close();
o.close();
return 0;
}