#define _CRT_SECURE_NO_WARNINGS #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING #include using namespace std; int main() { int n, x, cnt = 0; cin >> n >> x, x += '0'; char buf[40]; for (int i = 1; i <= n; i++) { sprintf(buf, "%d", i); for (char *p = buf; *p; p++) if (*p == x) cnt++; } cout << cnt; return 0; }