Pagini recente » Cod sursa (job #1875668) | Cod sursa (job #1149386) | Cod sursa (job #457928) | Istoria paginii runda/moisil_dornescu | Cod sursa (job #2251692)
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int p;
int cautare(int p)
{
int x = 5, nr5 = 0, doppel;
if(p == 0)
return 1;
else {
do {
doppel = x;
while(doppel % 5 == 0) {
doppel = doppel / 5;
nr5++;
}
if(nr5 == p)
break;
x = x + 5;
} while(nr5 < p);
}
if(nr5 == p)
return x;
else
return -1;
}
int main()
{
f >> p;
g << cautare(p);
return 0;
}