Cod sursa(job #1365453)

Utilizator shanti_zmuschiShanti Zmuschi shanti_zmuschi Data 28 februarie 2015 12:02:06
Problema Factorial Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.65 kb
#include<fstream>
ifstream fin("fact.in");
ofstream fout("fact.out");
int P,x,i,v[100000000],ok,k,n,N;
int main()
{
    fin>>P;
    if(P==0)
        fout<<1;
    else
    {
        while(x!=P)
        {
            for(i=0;i<N;i++)
            {
                v[i]=i+1;
                if(v[i]%10==2)
                    ok++;
                if(v[i]%10==5)
                    k++;
                if(v[i]%10==0)
                    n++;
                if(k>ok)
                    x=k+n;
                else
                    x=k+n;
                N++;
            }
        }
        fout<<N-1;
    }
    fin.close();
    fout.close();
    return 0;
}