Cod sursa(job #264171)

Utilizator BaduBadu Badu Badu Data 21 februarie 2009 17:15:32
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.4 kb
#include<stdio.h>
long p,nr;
inline long find(long st,long dr){
	int mj = (st + dr) >> 1;
	if(st>dr) return nr;
	if ( mj/5 >= p ) {
		if(mj/5 ==  p) nr = mj;
		return find(st , mj-1 );
	}
	if ( mj/5 < p ) return find(mj+1 , dr );
}
int main(){
	freopen("fact.in","rt",stdin);
	freopen("fact.out","wt",stdout);
	scanf("%ld",&p);
	long nrr = find(1,100000000);
	printf("%ld",nrr);
	return 0;
}