Cod sursa(job #2991023)

Utilizator gabiccGabriel Cocan gabicc Data 8 martie 2023 21:56:42
Problema Factorial Scor 90
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.65 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main()
{
    int P;
    int N = 0, V = 0;
    fin >> P;
    if(P == 0)
        N = 1;
    else
    {
        int  exp = 1;
        int i=0;
        while(i < P)
        {
            N += 5;
            V = N;
            while(V % 5 == 0){
                V /= 5;
                i++;
            }
            ///if(N % 25 == 0)
                ///i++;
            if(i != P && i >P)
            {
                i = P;
                N = -1;
            }
        }
    }
    fout << N;
    return 0;

}