Cod sursa(job #36044)
Utilizator | Data | 22 martie 2007 21:33:12 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include<fstream.h>
int main(){
ifstream fin("fact.in");
ofstream fout("fact.out");
long int P,nr,x=0,N=0;
fin>>P;
if (P==0)
fout<<1;
else
/* while (N!=P){
x+=5;
nr=x;
while (nr%5==0){
nr/=5;
N++;}
} */
N=P*5;
if (N!=P||P<0)
fout<<-1;
else
fout<<x;
fin.close();
fout.close();
return 0;
}