Cod sursa(job #2256632)

Utilizator RadutaLaviniaElenaRaduta Lavinia Elena RadutaLaviniaElena Data 8 octombrie 2018 21:38:52
Problema Factorial Scor 25
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <fstream>

using namespace std;

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