按照题意直接写即可
int main()
{
int n,m,i,k,p;
int count = 0;
scanf("%d %d",&n,&m);
for(i = 1;i<=n;i++)
k = i;
while(k)
p = k%10;
if(p== m)
count++;
}
k = k/10;
printf("%d",count);
return 0;