Cod sursa(job #2815534)

Utilizator P1zd0SuntBetoAlbert Beto P1zd0SuntBeto Data 9 decembrie 2021 19:38:31
Problema Factorial Scor 20
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <iostream>
#include <fstream>

using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int n;
int main()
{
    in >> n;

    if(!n)
    {
        out << 1;
        return 0;
    }
    int c = n * 5 - (((n * 5) / 25 - 1) * 5);
    if (c % 25 == 0) {
        out << -1;
        return 0;
    }
    else {
        c = n * 5 - (((n*5) / 25) * 5);
        if ((n * 5) % 25 == 0)
            c += 5;
        out << c;
    }

    return 0;
}