Cod sursa(job #2271012)

Utilizator mirceatlxhaha haha mirceatlx Data 27 octombrie 2018 21:19:21
Problema Factorial Scor 40
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
    int N,P,i,nrzero=1;
    fin>>P;
    N=5;
    if(P==0)
    {
        fout<<1;
        return 0;
    }
    while(nrzero!=P)
    {
        N=N+5;
         int nrc=1;
        int nx=N/5;
         while(nx%5==0)
         {
             nrc++;
             nx=nx/5;
         }
         nrzero=nrzero+nrc;
       //  fout<<nrzero<<"\n";
    }
    fout<<N;
    return 0;
}