Cod sursa(job #2353410)

Utilizator AndreibatmanAndrei Croitoriu Andreibatman Data 24 februarie 2019 11:49:23
Problema Factorial Scor 30
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");
int 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;
}