Cod sursa(job #2353419)

Utilizator AndreibatmanAndrei Croitoriu Andreibatman Data 24 februarie 2019 11:52:58
Problema Factorial Scor 25
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
long long n,i,j,ok1,fact5;
int main()
{
    fin>>n;
    if(n==0)
    {
        fout<<1;
        return 0;
    }
    ok1=1;
    while(ok1==1)
    {
        i+=5;
        j=i;
        while(j%5==0)
            j/=5 , fact5++;
        if(fact5==n)
        {
            fout<<i;
            break;
        }
    }
    return 0;
}