Cod sursa(job #368762)
Utilizator | Data | 25 noiembrie 2009 19:58:24 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include<fstream.h>
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
long long p,n,min,j,a,b;
f>>p;
int gasit=0;
n=0;
a=b=0;
while(gasit==0)
{
n++;
j=n;
while(j%2==0)
{
j=j/2;
a++;
}
j=n;
while(j%5==0)
{
j=j/5;
b++;
}
if(a>b)
min=b;
else
min=a;
if(min==p)
{
gasit=1;
g<<n;
}
}
return 0;
}