Cod sursa(job #3141293)

Utilizator ingridliboteanLibotean Ingrid ingridlibotean Data 13 iulie 2023 14:35:24
Problema Factorial Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>
#include<bits/stdc++.h>
using namespace std;

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

int p, n;

int uc(int f)
{
    int i=0;
    while(f%10==0)
    {
       i++;
       f=f/10;
    }
    return i;
}


int main()
{
    int i=1,t=1,r;
    fin>>p;
    
    if(p==0) n=1;
    else
    {
        while(p)
        {
            t=t*i;
            r=uc(t);
            if(r==p) 
            {
                n=i;
                p=0;
            }
            i++;
        }
    }
    else n=-1;
    fout<<n;

    return 0;
}