Cod sursa(job #139795)
Utilizator | Data | 20 februarie 2008 18:02:37 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream.h>
#include<math.h>
ifstream f("fact.in");
ofstream g("fact.out");
long long fact(long long N)
{long long S=1;
for(int i=2;i<=N;i++)
S*=i;
return S;
}
int main()
{long long p,N=1;
int sw=1;
f>>p;
p=pow(10,p);
while(sw)
{
if(fact(N)%p==0) {g<<N;sw=0;}
N++;
}
return 0;
}