Cod sursa(job #2488977)

Utilizator TomKodeColev Thomas-Daniel TomKode Data 7 noiembrie 2019 20:43:47
Problema Factorial Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.31 kb
#include <fstream>
using namespace std;
ifstream fin("fact.in");
ofstream fout("fact.out");
int main()
{
    int p,x=5,aux;
    fin>>p;
    aux=p;
    for(int i=p;i;i++)
    {
     while(x<=i)
     {
aux-=i/x;
x*=5;
     }
     if(!aux)
     {fout<<i;
     break;}
    x=5;
    aux=p;
    }
}