#include using namespace std; int n, x, ans; int main() { // 121 -->2 // 1~121 --> // n=121 1~121 某个数字x出现了多少次 cin >> n >> x; for (int i = 1; i <= n; i++) { int t = i; //复制 while (t) { if (t % 10 == x) ans++; t /= 10; } } printf("%d", ans); return 0; }