Pagini recente » Cod sursa (job #1641410) | Cod sursa (job #3187113) | Cod sursa (job #2774177) | Cod sursa (job #1352410) | Cod sursa (job #545783)
Cod sursa(job #545783)
#include<iostream.h>
#include<fstream.h>
/*long int fact(int x)
{
if (x==0) return 1;
else return x*fact(x-1);
}*/
int main()
{
ifstream f;
f.open("fact.in");
ofstream g;
g.open("fact.out");
long int p;
f>>p;
int ok=0;
int i=1;
int k=0, l=0;
while (!ok)
{
k=0; l=0;
for(int j=1;j<=i;j++)
{ if (j%2==0) k++;
int aux=j;
if(aux%5==0)
while(aux%5==0)
{
aux=aux/5;
l++;
}
}
if ((l<=k) && (l==p)) ok=1;
else i++;
/*int y=fact(i);
int k=0;
while (y%10==0)
{
k++;
y=y/10;
}
if (k==p) ok=1;
else i++;*/
}
if (ok) g<<i;
return 0;
}