Cod sursa(job #2305330)
Utilizator | Data | 19 decembrie 2018 21:46:32 | |
---|---|---|---|
Problema | Factorial | Scor | 5 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <fstream>
#include <iostream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
int p,tmp = 0;
in >> p;
if (p == 0)
out << 1;
if ((p+1) % 6 == 0)
{
out << -1 << endl;
}
else
{
tmp = p * 5;
p = p * 5;
tmp = p - (p/25)*5;
out << tmp << endl;
}
}