Cod sursa(job #2074304)

Utilizator verde.cristian2005Verde Flaviu-Cristian verde.cristian2005 Data 24 noiembrie 2017 13:58:25
Problema Factorial Scor 90
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
unsigned long long div1[11],p,q,j,exp1[11];
bool verif(unsigned long long n)
{
    unsigned long long cnt=0,cat=0;
    cat=n/5;
    while(cat)
    {
     cnt+=cat;
     cat/=5;
    }
    if(cnt<p)
        return 0;
    return 1;
}
void cautbin()
{
    unsigned long long r=0,pas=1LL<<63;
    while(pas)
    {
        if(verif(r+pas)==0)
            r+=pas;
        pas/=2;
    }
    out<<r+1;
}
int main()
{
    in>>p;
    cautbin();
    return 0;
}