Cod sursa(job #1263295)

Utilizator alex72101Sfat Alexandru alex72101 Data 14 noiembrie 2014 14:19:27
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.35 kb
#include <iostream>
#include <fstream>
 
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");

int n,k;
long long i,x;
int main()
{
	fin>>n;
	while (k<n)
	{
		i+=5;
		x=i;
		while (x%5==0)
		{
			if (x%5==0) k++;
			x=x/5;
		}
		
	}
	if (k==n) fout<<i;
		else fout<<"-1";
	fin.close();
	fout.close();
	return 0;
}