Cod sursa(job #2256729)

Utilizator RadutaLaviniaElenaRaduta Lavinia Elena RadutaLaviniaElena Data 9 octombrie 2018 00:52:11
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <fstream>

using namespace std;

int main()
{
    ifstream fin("fact.in");
    ofstream fout("fact.out");
    long long int p; fin>>p;
    if(p==0)fout<<1;
    else
    {
        long long int n=0,c,ok=1,k=0;
        while(ok==1)
        {
            n+=5;
            c=n;
            while(c%5==0){c=c/5; k++;}
            if(k==p){fout<<n; ok=0;}
        }
        if(ok==1)fout<<-1;
    }
    fin.close();
    fout.close();
    return 0;
}