Cod sursa(job #401207)

Utilizator federerUAIC-Padurariu-Cristian federer Data 22 februarie 2010 16:49:09
Problema Factorial Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include<fstream.h>

long c2, c5, i, p, x;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main()
{
	fin>>p;
	i=2;
	while((c2<p) || (c5<p))
	{
		x=i;
		while(x%2==0)
		{
			c2++;
			x=x/2;
		}
		
		while(x%5==0)
		{
			c5++;
			x=x/5;
		}
		i++;
	}
	
	fout<<i-1;
	fin.close();
	fout.close();
	return 0;
}