Cod sursa(job #2986846)
Utilizator | Data | 1 martie 2023 13:17:44 | |
---|---|---|---|
Problema | Factorial | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
int P;
int N = 0;
fin >> P;
if(P == 0)
N = 1;
else
{
int exp = 1;
int i=0;
while(i < P)
{
N += 5;
if(N % 25 == 0)
i++;
i++;
if(i != P && i >P)
{
i = P;
N = -1;
}
}
}
fout << N;
return 0;
}