Pagini recente » Cod sursa (job #2634336) | Istoria paginii runda/lol1/clasament | Cod sursa (job #728857) | Cod sursa (job #487342) | Cod sursa (job #2151026)
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main ()
{
int f = 1, P, ct = 0;
fin >> P;
int ok = 0, aux;
for(int N = 1; N < 10000; N++)
{
f = 1;
for(int j = 1; j <= N; j++)
{
f = f * j;
}
while(f != 0)
{
if(f % 10 == 0)
{
ct++;
f = f / 10;
}
else
break;
}
if(ct == P)
{
ok = 1;
aux = N;
break;
}
else
ct = 0;
}
if (ok == 1)
fout << aux;
else
fout <<"-1";
fin.close();
fout.close();
return 0;
}