Pagini recente » Cod sursa (job #587942) | Cod sursa (job #8359) | Cod sursa (job #1184053) | Infoarena Monthly 2012, Runda 12 - Clasament | Cod sursa (job #357027)
Cod sursa(job #357027)
#include<fstream.h>
#include<iostream.h>
int main ()
{ int A,B,C,K,d,l,P,i,m,aux,S;
ifstream f("date.in");
ofstream g("date.out");
f>>A>>B>>C>>K;
m=0;
if(B<A){aux=A; A=B; B=aux;}
for(i=A;i<=B;i++)
{l=0;
while(i!=0){d=i%10;
if(d==C)l++;
i=i/10;}
if(l>=K)m++;}
S=B-A+1;
P=m/S;
g<<P;
f.close();
g.close();
return 0;
}