Cod sursa(job #287826)
Utilizator | Data | 25 martie 2009 11:07:59 | |
---|---|---|---|
Problema | Factorial | Scor | 35 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 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;
if(p==0)g<<1;
else {while(q<p)
{n+=5;
q+=nr5(n);
}
g<<n<<'\n';}
return 0;
g.close();
f.close();
}