Cod sursa(job #1820466)

Utilizator CristiBexOU Cristian CristiBex Data 1 decembrie 2016 19:31:14
Problema Factorial Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.44 kb
#include <fstream>
using namespace std;
ifstream in("fact.in");
ofstream out("fact.out");
int main()
{
    int k=0,cp,ok=1;
    unsigned long long int P;
    unsigned int N=5;
    in>>P;
    if(P==0)
        out<<1;
    while(k<P)
    {
        cp=N;
        while(cp%5==0 && ok==1)
        {
            k++;
            if(k==P)
                {ok=0;out<<N;}
            cp/=5;
        }
        N=N+5;
    }
    return 0;
}