Cod sursa(job #267293)
| Utilizator | Data | 26 februarie 2009 23:47:32 | |
|---|---|---|---|
| Problema | Factorial | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include<fstream.h>
long p;
ifstream f("fact.in");
ofstream g("fact.out");
int verif(int x)
{ long f=0;
while(x!=0)
{ if(x%10==0) f++, x/=10;
else return 0;
}
if(f==p) return 1;
return 0;
}
void det_pal()
{ int ok=0, i=1;
double n=1;
while(ok==0 && i<=)
{ n = n*i;
if(verif(n)==1) g << n, ok = 1;
else i++;
}
if(ok==0) g << -1;
}
int main()
{ f >> p;
if(p==0) g<< 1;
det_pal();
g.close();
return 0;
}