Pagini recente » Cod sursa (job #1231526) | Cod sursa (job #793682) | Cod sursa (job #2770283) | Cod sursa (job #3158177) | Cod sursa (job #730572)
Cod sursa(job #730572)
#include <fstream>
#include <cmath>
using namespace std;
int i,n,p,x;
ifstream in("fact.in");
ofstream out("fact.out");
int pow(int base, int power) {
if (power == 0) return 1;
if (power == 1) return base;
if (power % 2 == 0) return pow(base * base, power / 2);
if (power % 2 == 1) return base * pow(base * base, power / 2);
}
int main()
{
in >> p;
x = pow(10,p);
n=1;
while(n%x!=0)
{
++i;
n *= i;
}
if(n>pow(10,8))
{
out<<-1;
}
else
{
out<<i;
}
in.close();
out.close();
return 0;
}