Cod sursa(job #1733935)

Utilizator mIllIbytemIllI byte mIllIbyte Data 26 iulie 2016 09:38:59
Problema Factorial Scor 15
Compilator c Status done
Runda Arhiva de probleme Marime 0.25 kb
#include<stdio.h>
long long p,k,i,n;main(){freopen("fact.in","r",stdin);freopen("fact.out","w",stdout);
scanf("%lld",&p);
long long fact=1,sum=0;
for(;sum<p;)sum+=fact,fact*=5;
for(n=fact,k=sum;p<=k&&n;n--)for(i=5,k=0;i<=n;i*=5)k+=n/i;printf("%lld",n+2);}