Cod sursa(job #751398)

Utilizator radu_bucurRadu Bucur radu_bucur Data 25 mai 2012 23:54:17
Problema Factorial Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.41 kb
#include <cstdio>
int x,n,nr,i;
bool verif (int y){
	int p;
	p=0;
	while (y>=5){
		p=p+y/5;
		y=y/5;
	}
	if (p<=n) return true;
	return false;
}
int main(){
	freopen ("fact.in","r",stdin);
	freopen ("fact.out","w",stdout);
	scanf ("%d",&n);
	x=2; nr=1;
	while (nr<27){ x=x*2; nr++;} 
	x=1024;
	for (i=0;x!=0;x=x/2)
		if (verif(i+x)) i=i+x;
	if (n==0) printf ("0");
    else printf ("%d",i-(i%5));
}