Cod sursa(job #1649660)
Utilizator | Data | 11 martie 2016 14:30:25 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int t;
long long p,i;
bool ok;
int main()
{
f>>p;
ok=true;
if(p==0)
g<<-1;
if(p>=1&&p<=4)
{
ok=false;
g<<p*4;
}
if(ok==true){
for(i=5;i<=p;i+=10)
{
t++;
if(p==i)
{
g<<-1;
ok=false;
}
}
}
if(ok==true){
if(p>=6)
g<<(p*5)-(5*t);}
}