Cod sursa(job #3280479)

Utilizator RaresO174Olariu Rares-Stefan RaresO174 Data 26 februarie 2025 16:16:37
Problema Factorial Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.42 kb
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
fstream fin("fact.in");
ofstream fout("fact.out");

int main(){
    int P,N=0,i,j,ok=0,nr,nrcifzero;
    fin >> P;
    nrcifzero=pow(10,P);
    for(i=1;i<=100 && ok==0;i++){
        nr=1;
        for(j=1;j<=i;j++)
            nr=nr*j;
        if(nr%nrcifzero==0){
            ok=1;
            N=i;
        }
    }
    fout << N;
}