0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-30 20:56:29 +00:00
OI-codes/Luogu/P1980/P1980.cpp

24 lines
331 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
int n, x, ans;
int cntx(int num) {
int res = 0;
while (num) {
res += num % 10 == x;
num /= 10;
}
return res;
}
int main() {
cin >> n >> x;
for (int i = 1; i <= n; i++) {
ans += cntx(i);
}
cout << ans << endl;
return 0;
}