Pagini recente » Cod sursa (job #2039367) | Cod sursa (job #1991412) | Cod sursa (job #1292366) | Cod sursa (job #2446980) | Cod sursa (job #2785354)
#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++;
if (x % 5 == 0)
{
y = x ;
while (y % 5 == 0) {
y = y / 5;
p5++;
}
}
}
if (p5 > p)
fout << -1;
else
fout << x;
}
};
int main()
{
int p;
fin >> p;
Problema po(p);
po.Rezolvare();
}