Cod sursa(job #24147)
Utilizator | Data | 1 martie 2007 20:44:32 | |
---|---|---|---|
Problema | Factorial | Scor | 40 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.27 kb |
#include<fstream.h>
ifstream f("fact.in");
ofstream g("fact.out");
long kk(long x)
{long hh=0;
while(x%5==0)
{hh++; x=x/5;}
return hh;
}
int main()
{long n;
f>>n;
if(n==0) g<<1;
else
{long k=0,i=5;
while(k<n)
{k=k+kk(i);
i=i+5;
}
g<<i-5;
}
return 0;
}