Cod sursa(job #11479)
| Utilizator | Data | 31 ianuarie 2007 19:18:28 | |
|---|---|---|---|
| Problema | Factorial | Scor | 25 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.26 kb |
//Bou Marian Catalin
#include<fstream.h>
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{long long a,n=0,p,i=0;
fin>>p;
if(p==0)fout<<'1';
else
{while(i<p){n=n+5;a=n;while(a%5==0){i++;a=a/5;}}
if(i==p)fout<<n;
if(i>p)fout<<"-1";}
return 0;}