Pagini recente » Profil VladPislaru | Cod sursa (job #572131) | Cod sursa (job #2675139) | Cod sursa (job #508631) | Cod sursa (job #1449493)
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
fstream file;
unsigned int p, n;
file.open("fact.in", ios::in);
file >> p;
file.close();
file.open("fact.out", ios::out);
if(p == 0) {
file << 1 << endl;
} else {
n = (p - p / 5) * 5;
if(!((p - p / 5 + 1) % 5)) {
file << -1 << endl;
} else {
file << n << endl;
}
}
file.close();
return 0;
}