Cod sursa(job #3195533)

Utilizator verde.cristian2005Verde Flaviu-Cristian verde.cristian2005 Data 21 ianuarie 2024 10:21:05
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <bits/stdc++.h>
using namespace std;

#ifndef ACASA
    ifstream in("factorial.in");
    ofstream out("factorial.out");
    #define cin in
    #define cout out
#endif

int main()
{
#ifdef ACASA
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
#endif
    int p, n = 5;
    cin >> p;
    while(p > 0)
    {
        int cn = n;
        while(cn % 5 == 0)
        {
            p--;
            cn /= 5;
        }
        n++;
    }
    cout << n - 1;
    return 0;
}