Cod sursa(job #24010)
Utilizator | Data | 1 martie 2007 19:29:32 | |
---|---|---|---|
Problema | Factorial | Scor | 60 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.32 kb |
#include <fstream.h>
int main(){
unsigned long p,k,i,aux;
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if(p>0){
i=5;k=0;
while(k<p){
aux=i;
while(aux%5==0){
aux/=5;k++;
}
i+=5;
}
if(k==p)
g<<i-5;
else
g<<-1;
}else
g<<1;
return 0;
}