Cod sursa(job #632253)

Utilizator VimanAdrianVimanAdrian VimanAdrian Data 10 noiembrie 2011 18:20:47
Problema Factorial Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.34 kb
#include <fstream>
#include <iostream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
int p,ok=0,n,fives=0,pp;
in>>p;

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

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

out.close();
in.close();

return 0;
}