Cod sursa(job #903711)
| Utilizator | Data | 2 martie 2013 17:15:54 | |
|---|---|---|---|
| Problema | Factorial | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.37 kb |
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
int P; in >> P;
int i, j = 1;
if (P == 0) { out << 1; return 0; }
for (i = 1; ; i++, j++)
{
if (i % 5 == 0) j++;
if (j == P) break;
if (j > P) { out << -1; return 0; }
}
out << 5 * i;
return 0;
}
