#include using namespace std; int main() { int n, x, cnt = 0; cin >> n >> x; for (int i = 1; i <= n; i++) { int t = i; //注意这里的数位分离技巧 while (t > 0) { int ys = t % 10; if (ys == x) cnt++; t /= 10; } } printf("%d", cnt); return 0; }