Cod sursa(job #2679621)

Utilizator dragonking3499Toplicianu Iustin dragonking3499 Data 1 decembrie 2020 00:51:13
Problema Factorial Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.52 kb
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int verificare(long long d,int t)
{

    if(d%10==0)
    {
        t++; return verificare(d/10,t);
    }
    else
        return t;
}
int main()
{
    unsigned long long d,n;
    int  P,ok=0,t=0,j=1,c=0;
    f>>P;n=1;d=n;
    while (ok!=1)
    {
   t=verificare(d,t);
    if(t==P)
    {ok=1;g<<j;}
    else ok=0;
    if (ok==0)
    {j++;
    n=n*j;
    d=n;c=0;t=0;}
    }

    return 0;
}