Cod sursa(job #2282972)

Utilizator NeganAlex Mihalcea Negan Data 14 noiembrie 2018 19:55:41
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.43 kb
#include <fstream>

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

int main()
{
    int n, i = 1, cnt = 0, x;
    long long k
    fin >> k;
    if(k == 0)
    {
        fout << 1;
        return 0;
    }
    while(cnt < k)
    {
        x = i;
        while(x % 5 == 0)
        {
            cnt++;
            x /= 5;
        }
        i++;

    }
    fout << i - 1;

    return 0;
}