Cod sursa(job #292517)
Utilizator | Data | 31 martie 2009 11:22:52 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.29 kb |
#include<fstream.h>
main()
{long p,n=0;
ifstream i("fact.in");
ofstream o("fact.out");
i>>p;
if(p%5==0 && p%12!=0)
o<<"-1"<<'\n';
else
{while(p>0)
{n=n+25;
p=p-6;
}
while(p<0)
{n=n-5;p++;}
o<<n<<'\n';
}
i.close();
o.close();
return 0;
}