Cod sursa(job #79131)
Utilizator | Data | 20 august 2007 22:54:28 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.34 kb |
#include <cstdio>
#define ui long long
int main()
{
ui cnt, n, i, p, q;
freopen("fact.in","r",stdin);
freopen("fact.out","w",stdout);
scanf("%lld", &n);
i=(1<<31);
for(cnt=(1<<30);cnt;cnt>>=1)
if(i-cnt>=1)
{
q=0;
p=i-cnt;
while(p)q+=p/5, p/=5;
if(q>=n) i-=cnt;
}
printf("%lld\n", i);
return 0;
}