Pagini recente » Cod sursa (job #1865344) | Cod sursa (job #1161101) | Cod sursa (job #493688) | Cod sursa (job #3239973) | Cod sursa (job #401745)
Cod sursa(job #401745)
#include<cstdio>
const int N=1<<15;
long long p;
int zero (int n)
{
int s=0;
while (n)
{
s+=n/5;
n=n/5;
}
return s;
}
int fact(int p)
{
int i,pas=N;
for ( i=0;pas!=1;pas=pas/2)
if (zero(i+pas)<p)
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;
}