Cod sursa(job #730569)
Utilizator | Data | 6 aprilie 2012 15:43:15 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.51 kb |
#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;
}
out<<i;
in.close();
out.close();
}