数字出现的次数
import java.util.Scanner;
public class Main {
public static int digitCounts(int n, int k) {
int count=0;
if(n%10>=k)
count++;
for(int i=10;i<=n;i*=10){
count+=n/i*i/10;
if((n%(i*10))/i==k)
count+=n%i+1;
if((n%(i*10))/i>k)
count+=i;
if(k==0)
count-=i;
}
return count;
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n = input.nextInt();
int k = input.nextInt();
System.out.println(digitCounts(n, k));
}
}