Cod sursa(job #427052)

Utilizator ms-ninjacristescu liviu ms-ninja Data 27 martie 2010 14:28:10
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <fstream>

using namespace std;

int main()
{
	long n, aux, s, exp;
	ifstream fin("fact.in");
	ofstream fout("fact.out");
	
	
	fin>>n;
	
	int ok=0;
	s=0;
	while(ok==0)
	{
		aux=s;
		exp=0;
		while(aux)
		{
			exp+=aux/5;
			aux=aux/5;
		}
		if(exp==n)
		{
			ok=1;
		}else
			s+=5;
	}
	
	fout<<s;
	
	return 0;
}