Cod sursa(job #2471234)

Utilizator Florinos123Gaina Florin Florinos123 Data 10 octombrie 2019 17:04:23
Problema Factorial Scor 15
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.49 kb
#include <iostream>
#include <fstream>
using namespace std;
long verf(long n)
{
    long rez=0;
    while(n)
    {
        rez=rez+n/5;
        n=n/5;
    }
    return rez;
}
int main()
{
ifstream f("fact.in");
ofstream g("fact.out");
long long p,i,gasit=0,nr,x;
f>>p;
nr=p;
if(p==0)
    g<<1;
else
{


while(gasit==0)
{
    nr++;
    if(verf(nr)==p)
    {
        x=nr;
        gasit=1;
    }

}
if(gasit==1)
    g<<x;
else
    g<<-1;
}


    return 0;
}