Cod sursa(job #708786)

Utilizator BeniLehelBeni Lehel BeniLehel Data 7 martie 2012 10:47:17
Problema Factorial Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.31 kb
#include<stdio.h>
int n,c,q,w=0;
int main()
{
	freopen("fact.in","r",stdin);
	freopen("fact.out","w",stdout);
	scanf("%d",&c);
	int i=0;
	while(c!=w)
	{
		q=5;
		int osz=0;
		while(i/q)
		{
			osz+=i/q;
			q*=5;
		}
		w=osz;
		i+=5;
	}
	if(i)
	printf("%d",i-5);
	else
		printf("1");
	return 0;
}