Cod sursa(job #149336)
Utilizator | Data | 5 martie 2008 16:41:56 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<fstream.h>
long n,m=0,i=0,aux;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>n;
while(n!=m)
{ i+=5; if( (i/5)%5 ) m++;
else {aux=i;
while (aux!=1)
{aux/=5;m++;}
}
}
if(m==0) g<<"1";
else g<<i;
f.close();
g.close();
return 0;
}