Cod sursa(job #1234687)

Utilizator FawkesAndrei Colhon Fawkes Data 27 septembrie 2014 20:12:30
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    ifstream in("fact.in");
    ofstream out("fact.out");
 int p,ok=0,n,twos=0,fives=0,pp;
 in>>p;

 for(n=1;ok==0 && n>0;n++)
 {
  pp=n;
  while(pp%5==0){
			if (pp%5==0) { fives++; pp=pp/5;}
			}

		if(fives>=p)
			ok=n;
	}

	if(fives != p) out<<-1;
	else out<<ok;
    return 0;
}