Cod sursa(job #11705)
Utilizator | Data | 1 februarie 2007 13:48:32 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <IOstream.h>
#include <fstream.h>
ifstream in ("fact.in");
ofstream out ("fact.out");
int howmanyfives (long a)
{
int i=0;
while (a>=5 && a%5==0)
{
i++;
a/=5;
}
return i;
}
int main ()
{
long N=0,P;
register long i,zeros=0;
in>>P;
while (zeros<P)
{
N+=5;
zeros+=howmanyfives(N);
}
out<<N;
return 0;
}