Pagini recente » Cod sursa (job #1553503) | Cod sursa (job #43802) | Cod sursa (job #539) | Cod sursa (job #2571752) | Cod sursa (job #2785381)
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
class Problema
{
int p;
public:
Problema(void)
{
p = 0;
}
Problema(int x)
{
p = x;
}
void Rezolvare()
{
int p5 = 0;
int x =0,y;
while (p5 < p)
{
x=x+5;
y = x;
while (y % 5 == 0)
{
p5++;
y = y / 5;
}
}
if (p == 0)
fout << 1;
else
if (p5 > p)
fout << -1;
else
fout << x;
}
};
int main()
{
int p;
fin >> p;
Problema po(p);
po.Rezolvare();
}