Cod sursa(job #21350)
| Utilizator | Data | 23 februarie 2007 13:03:56 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.38 kb |
#include<stdio.h>
long v[1000000];
long val(long a)
{
long s=0;
while(a>0)
{
s+=a/5;
a/=5;
}
return s;
}
long cauta(int a,int b,int n)
{
long c,t;
if(a==b) return b;
c=(a+b)/2;
t=val(c);
if(t>=n) return cauta(a,c,n);
else return cauta(c+1,b,n);
}
int main()
{
long N;
scanf("%ld",&N);
printf("%ld",cauta(1,50000000,N));
return 0;
}