Cod sursa(job #11689)
Utilizator | Data | 1 februarie 2007 11:45:16 | |
---|---|---|---|
Problema | Factorial | Scor | 25 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 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==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);
}
if (zeros == 0)
out<<1;
out<<N;
return 0;
}