Cod sursa(job #49234)
| Utilizator | Data | 5 aprilie 2007 16:39:08 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.33 kb |
#include<fstream.h>
int main(){
ifstream fin("fact.in");
ofstream fout("fact.out");
int P,nr,x=5,N=0;
fin>>P;
if (P==0)
fout<<-1;
else
while (N!=P){
x+=10;
nr=x;
while (nr%25==0){
nr/=5;
N++;}
N+=2;
}
if (N>P)
x=-1;
fout<<x;
fin.close();
fout.close();
return 0;
}