Pagini recente » Cod sursa (job #1839794) | Rating Berke Musellim (bigboiberke) | Cod sursa (job #1899319) | Cod sursa (job #943354) | Cod sursa (job #323622)
Cod sursa(job #323622)
#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(y>p)
break;
}
g << "-1\n";
g.close();
return 0;
}