Pagini recente » Istoria paginii runda/eusebiu_oji_2005_cls11-12 | Cod sursa (job #2227980) | Cod sursa (job #829288) | Cod sursa (job #820932) | Cod sursa (job #323621)
Cod sursa(job #323621)
#include <fstream>
#include <iostream>
using namespace std;
fstream f,g;
long p;
long x;
long d,c;
int main()
{
f.open("fact.in",fstream::in);
f >> p;
g.open("fact.out",fstream::out);
if(p==0)
{
g << "1\n";
g.close();
return 0;
}
long y,i,aux;
y=0;
for(i=1;;i++)
{
aux = i;
while(aux%5==0)
{
aux/=5;
y++;
}
if(y == p)
{
g << i << "\n";
g.close();
return 0;
}
if(i>=10*p)
break;
}
g << "-1\n";
g.close();
return 0;
}