Cod sursa(job #185599)
Utilizator | Data | 25 aprilie 2008 18:15:07 | |
---|---|---|---|
Problema | Factorial | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include<fstream.h>
int main()
{
ifstream fin("fact.in");
ofstream fout("fact.out");
long s=0,p,k=0,aux;
fin>>p;
while(k<p)
{
s+=5;
aux=s;
while(aux%5==0)
{
aux/=5;
k++;
}
}
if(p==0)
fout<<1;
else
if(p==k)
fout<<s;
else
if(p!=k)
fout<<"-1";
return 0;
}