Cod sursa(job #1013104)
| Utilizator | Data | 20 octombrie 2013 12:06:32 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.52 kb |
#include <fstream>
using namespace std;
int p;
void citire ()
{
ifstream in ("fact.in");
in >> p;
in.close ();
}
void afis (long long n)
{
ofstream out ("fact.out");
out << n;
out.close ();
}
void solve ()
{
if (p == 0)
afis (1);
else
if (p < 5)
afis (p * 5);
else
if (p == 5)
afis (-1);
else
afis ((p * 4) + (p - 5));
}
int main()
{
citire ();
solve ();
return 0;
}
