Cod sursa(job #8906)
Utilizator | Data | 25 ianuarie 2007 22:32:47 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <math.h>
#include <fstream.h>
int nr,p,aux,aux2,s;
ifstream f;ofstream g;
int main()
{f.open("fact.in");g.open("fact.out");
while(!f.eof())
{f>>p;f.get();
nr=0;s=1; aux2=0;
while(aux2!=p)
{ nr++;
aux=nr;aux2=0;
while(aux)
{aux2+=floor(aux/5);
aux/=5;
}
}
g<<nr<<'\n';
}
f.close();g.close();
return 0;
}