Cod sursa(job #560760)

Utilizator chri5tyJohn Doe chri5ty Data 18 martie 2011 17:47:30
Problema Factorial Scor 60
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.25 kb
#include <fstream>

using namespace std;

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

int main()
{
	int i,N,P;
	
	fin>>P;

	N=0;
	while(P>0)
	{
		i=N+=5;
		while(i%5==0){P--;i/=5;}
	}
		
	
	fout<<((P==0)?(N?N:1):-1);
}