Cod sursa(job #416789)
Utilizator | Data | 13 martie 2010 15:42:24 | |
---|---|---|---|
Problema | Factorial | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include<fstream>
using namespace std;
int p,d2,d5,n;
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
n=2;
while(d2<p||d5<p)
{ int m=n;
if(m%5==0)
while(m&&m%5==0)
{
m/=5;
d5++;
}
if(m%2==0)
while(m&&m%2==0)
{
m/=2;
d2++;
}
n++;
}
g<<n-1;
return 0;
}