Cod sursa(job #1443029)

Utilizator ankhanca harceanu ankh Data 26 mai 2015 17:56:11
Problema Cifre Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.45 kb
#include<iostream>
#include<fstream>
using namespace std;
int n,p,j,x,i,K,l,C,A,B,m,y;
float h;
int main()
{ifstream f("coins.in",ios::in);
ofstream g("coins.out",ios::out);
f>>A>>B>>C>>K;
for(i=A;i<=B;i++)
   {j=0;x=0;
    y=i;
       while(y!=0)
   {m=y%10;
   if(m==C) {j=1;
            x++;}

     y=y/10;
   }
    if(j==1 && K<=x) n++;
    p++;
   }
h=((float)n) / p;
g.precision(4);
g<<h;
f.close();
g.close();
return 0;}