Cod sursa(job #1273710)

Utilizator stephanStefan stephan Data 22 noiembrie 2014 21:38:13
Problema Factorial Scor 45
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.32 kb
#include <iostream>
#include <fstream>

using namespace std;

int main(){
	int p,i=5,n5=0,ci;
	ifstream fin("fact.in");
	ofstream fout("fact.out");

	fin >> p;

	while(n5<p){
		ci=i;
		while(ci%5==0){
			ci=ci/5;
			n5++;
		}
		i=i+5;
	}

	if(n5>p)
	fout << "-1";
	else
	fout << i-5;

return 0;
}