Cod sursa(job #23910)
Utilizator | Data | 1 martie 2007 16:36:55 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <fstream.h>
#include <math.h>
int main(){
unsigned long p,i,aux,k;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if(p<=pow(10,8))
if(p>=1){
k=0;
i=5;
while(k<p){
if(i%5==0){
aux=i;
while(aux%5==0){
aux/=5;
k++;
}
}
i+=5;
}
g<<i-5;
}else
g<<1;
else
g<<-1<<endl;
return 0;
}