Cod sursa(job #312024)

Utilizator cvicentiuCiorbaru Vicentiu Marian cvicentiu Data 4 mai 2009 22:08:12
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <stdio.h>
int p;
long long lo = 1, hi = 500000000LL, aux, mid;
bool gasit;
int zero (long long val){
	if (val > 5)
		return val / 5 + zero (val / 5);
	return 0;
}



int main(){
	freopen("fact.in", "r", stdin);
	freopen("fact.out", "w", stdout);
	scanf ("%d", &p);
	
	/*if (p == 0) printf("1");
	else {
		for (; lo < hi; ){
			mid = lo + (hi - lo)/2;
			aux = zero(mid);
			if ( aux == p ) {
				mid = mid - mid % 5;
				printf("%lld", mid);
				gasit = true;
				lo = hi;
			} else{
				if ( aux < p ) 
					lo = mid + 1;
				else hi = mid - 1;
			};	
		};*/
		if (gasit != true) printf("-1");
	//}

return 0;
};