Cod sursa(job #2611092)
Utilizator | Data | 6 mai 2020 13:16:15 | |
---|---|---|---|
Problema | Factorial | Scor | 15 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.35 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main() {
int P;
in >> P;
if (P == 0)
out << 1;
else if (P == 5 || P % 6 == 5)
out << -1;
else
out << P * 5 - 5 * ((P - 1) / 5);
in.close();
out.close();
return 0;
}