Cod sursa(job #1957271)

Utilizator DavidLDavid Lauran DavidL Data 7 aprilie 2017 14:05:49
Problema Factorial Scor 35
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.39 kb
#include <fstream>
using namespace std;
ifstream fi("fact.in");
ofstream fo("fact.out");

int P,N,factori,auxN;
int main()
{
    fi>>P;
    if (P==0)
        N=1;
    while (factori<P)
    {
        N+=5;
        auxN=N;
        while (auxN%5==0)
        {
            factori++;
            auxN/=5;
        }
    }
    fo<<N;
    fi.close();
    fo.close();
    return 0;
}