Cod sursa(job #2679618)

Utilizator dragonking3499Toplicianu Iustin dragonking3499 Data 1 decembrie 2020 00:05:57
Problema Factorial Scor 10
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.43 kb
#include<iostream>
#include<fstream>
using namespace std;
ifstream f("fact.in");
ofstream g("fact.out");
int main()
{
    int  n,P,ok=0,t=0,j=1,d,c=0;
    f>>P;n=1;d=n;
    while (ok!=1)
    {
   while(c==0)
    {
        c=d%10;
        if(c==0)
            t++;
        d=d/10;
    }
    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;
}