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