Cod sursa(job #2261674)
Utilizator | Data | 16 octombrie 2018 16:03:25 | |
---|---|---|---|
Problema | Factorial | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int p,n=-1;
ifstream be("fact.in");
be>>p;
be.close();
if (p%6==0)
n=p*5-p/6*5;
else
if ((p+1)%6==0)
n=-1;
else
n=p*5+p/6*5-10*p/6;
ofstream ki("fact.out");
ki<<n;
ki.close();
return 0;
}