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