Pagini recente » Cod sursa (job #2204599) | Cod sursa (job #666703) | Cod sursa (job #1158062) | Cod sursa (job #2729605) | Cod sursa (job #401748)
Cod sursa(job #401748)
#include<cstdio>
const int N=1<<15;
long long p;
int zero (long long n)
{
int s=0;
while (n)
{
s+=n/5;
n=n/5;
}
return s;
}
long long fact(int p)
{
int i,pas=N;
for ( i=0;pas!=1;pas=pas/2)
if (zero(i+pas)<p)
i=i+pas;
return (i+1);
}
int main()
{
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%lld",&p);
long long k=fact(p);
printf("%lld",k);
return 0;
}