Pagini recente » Cod sursa (job #1450586) | Cod sursa (job #1076444) | Diferente pentru jc2012 intre reviziile 29 si 17 | Monitorul de evaluare | Cod sursa (job #843842)
Cod sursa(job #843842)
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int p,ok=0,n,twos=0,fives=0,pp;
fin>>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 fout<<ok;
fout.close();
fin.close();
return 0;
}