Cod sursa(job #787357)

Utilizator sebyMarinescu Sebastian-Ioan seby Data 13 septembrie 2012 11:10:31
Problema Factorial Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.3 kb
#include<stdio.h>
#include<math.h>
int n,nr,i,k,aux,p;
int main()
{
	freopen("fact.in","r",stdin);
	freopen("fact.out","w",stdout);
	scanf("%d",&p);
	nr=0;
	i=1;
	while(nr<p)
	{
		i++;
		k=0;
		aux=i;
		while(aux%5==0)
		{
			aux/=5;
			k++;
		}
		nr+=k;
	}
	printf("%d",i);
	return 0;
}