Cod sursa(job #2988698)

Utilizator spar13Spar 13 spar13 Data 5 martie 2023 12:55:26
Problema Factorial Scor 45
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

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

void solve(){
    int p;
    fin>>p;
    int c=0;
    for(int i=5;;i+=5) {
        int t=i;
        while(t%5==0) {
            c++;
            if(c==p) {
                fout<<i<<'\n';
                return;
            }
            t/=5;
        }
    }
}

int32_t main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    #ifdef ONPC
        cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}