Cod sursa(job #148626)
Utilizator | Data | 4 martie 2008 16:51:37 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.48 kb |
#include<fstream.h>
long long n,p,aux,x=0,i=0;
int main ()
{
ifstream f("fact.in");
ofstream g("fact.out");
f>>p;
if (p==0) g<<1;
else {
while (x<p)
{aux=i
i+=25;x+=6
if (x>p)
{i=aux
while (x<p)
{i+=5;x++;
break;}
}
if (x==p) g<<i;
else g<<-1;
}
f.close();
g.close();
return 0;
}