Cod sursa(job #2717840)
Utilizator | Data | 8 martie 2021 00:20:33 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.38 kb |
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream fin("fact.in");
ofstream fout("fact.out");
long long p, i, count=1;
fin >> p;
if (p==0) {
fout << 1;
return 0;
}
for (i=5; i<=p; i+=6, count++)
if (p==i) {
fout << -1;
return 0;
}
fout << 5*p-(count-1)*5;
return 0;
}