Cod sursa(job #2269836)

Utilizator niculaestefan22Stefan Niculae niculaestefan22 Data 26 octombrie 2018 17:26:43
Problema Factorial Scor 15
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.4 kb
#include <iostream>
#include <fstream>

using namespace std;

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

int p;

int nrz(int x)
{
    int s=0;
    while(x!=0)
    {
        s=s+x/5;
        x=x/5;
    }
    return s;
}

int main()
{
    fin>>p;
    int ans=1;
    while(nrz(ans)<p)
    {
        ans++;
    }

    fout<<ans<<"\n";
    fout.close();
    return 0;
}