Cod sursa(job #2251673)

Utilizator DariusPicaDarius Pica DariusPica Data 1 octombrie 2018 20:30:30
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include <iostream>
#include <fstream>

using namespace std;

ifstream fin("fact.in");
ofstream fout("fact.out");

int main()
{
    int P;
    fin>>P;
    if(P==0) fout<<1;
    else{
    int nrp=0,t;
    for(int i=5;i<=INT_MAX;i+=5)
    {
        int x=i;
        while(x%5==0)
        {
            x=x/5;
            nrp++;
        }
        if(nrp>=P)
        {
            t=i;
            break;
        }
    }
    if(t%5==0) fout<<t;
    }
}