Pagini recente » Cod sursa (job #1084213) | Cod sursa (job #3228112) | Cod sursa (job #3279204) | Cod sursa (job #2919285) | Cod sursa (job #2620999)
#include <iostream>
#include <fstream>
#include <map>
#include <string>
using namespace std;
int main()
{
int N,P,nu = -1;
ifstream f("fact.in");
ofstream g("fact.out");
f>>P;
if(P < 0)
g<<nu;
else
{ if(P == 0)
g<<1;
else
{
N = 0;
int nrzero = 0;
while(nrzero < P)
{
N+=5;
int x = N;
while(x)
{
if(x%5 == 0)
nrzero++;
x = x/5;
}
}
if(nrzero == P)
g<<N;
else
{
g<<nu;
}
}
}
}