Cod sursa(job #287825)

Utilizator peteanvPetean Vlad peteanv Data 25 martie 2009 11:04:51
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.3 kb
#include<fstream.h>
ifstream f("fact.in");
ofstream g("fact.out");
int nr5(int n)
{int i=0;
while(n%5==0&&n)
{n=n/5;
i++;
}
return i;
}




int main()
{long p,q=0;
int n=0;
unsigned long s=1;
f>>p;
while(q<p)
{n+=5;
q+=nr5(n);
}
g<<n<<'\n';

return 0;
g.close();
f.close();
}