Cod sursa(job #2652026)

Utilizator ionutdrg45Ionut Dragan ionutdrg45 Data 24 septembrie 2020 08:42:13
Problema Factorial Scor 25
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <iostream>
#include <fstream>

using namespace std;


int get_0(int p) {
    int n = -1;
    int two_nr = 0;
    int nr_zero = 0;
    while(nr_zero != p) {
        n++;
        int aux_val = n;

        while(aux_val % 5 == 0 && aux_val) {
            aux_val /= 5;
            nr_zero++;
        }
    }
    if(n == -1) return 1;
    else return n;
}

int main()
{
    ifstream f("fact.in");
    ofstream g("fact.out");
    int x;
    f>>x;
    g<<get_0(x);
    f.close();
    g.close();
    return 0;
}