Cod sursa(job #1905470)

Utilizator andreiandriescuAndrei Andriescu andreiandriescu Data 6 martie 2017 08:30:01
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.46 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
long ok=1,n,nr0;
unsigned long long k,y;
int main()
{
    fin>>n; k=5; nr0=1;
    if(n==0)
    {
        fout<<1; return 0;
    }
    while(ok)
    {
        if(nr0==n)
        {
            fout<<k; ok=0;
        }
        y=k;
        while(y%5==0)
        {
            y=y/5;
            nr0++;
        }
        k+=5;
    }
}