Pagini recente » Cod sursa (job #1587457) | Cod sursa (job #524881) | Cod sursa (job #1263636) | Cod sursa (job #1414270) | Cod sursa (job #1983851)
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream l("fact.out");
int n,p,nr0,j,r,i,y,k,h,d,v[10000],nr,gasit;
int main()
{
f>>p;
gasit=0;
if (p==0)
{
cout<<1;
gasit=1;
}
if (p==1)
{
cout<<5;
gasit=1;
}
i=5;
while (i<=10000000000 and gasit==0)
{
n=i;
for (j=5; j<=n; j=j+5)
{
y=1;
while (r!=0)
{
r=j/5;
k=j%5;
h++;
v[h]=k;
}
for (i=h; i>0; i--)
{
y=y*10+v[i];
}
nr=0;
d=0;
while (d==0)
{
d=y%10;
nr++;
y=y/10;
}
nr0=nr0+nr;
}
if (p==nr0)
{
cout<<n;
gasit=1;
}
i++;
}
return 0;
}