Mai intai trebuie sa te autentifici.
Cod sursa(job #30910)
Utilizator | Data | 15 martie 2007 11:51:51 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.56 kb |
#include<fstream.h>
#include<math.h>
unsigned long p,n,e,i,d,c,ok;
void citire();
void prel();
void afis();
void citire()
{ ifstream fin("fact.in");
fin>>p;
fin.close();
}
void prel()
{ if(p==0) n=1;
c=1;
ok=0;
for(i=1;i<=c&&ok;i++)
{ d=i;
while(d%5==0)
{ d/=5;
e++;
}
if(e==p)
{ n=i;
break;
}
c++;
}
}
void afis()
{ ofstream fout("fact.out");
if(ok)fout<<n;
else fout<<-1;
fout.close();
}
int main()
{ citire();
prel();
afis();
return 0;
}