题解 | 记数问题
记数问题
https://www.nowcoder.com/practice/28b2d9f2bf2c48de94a1297ed90e1732
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
int n,x;
cin>>n>>x;
vector <int> v(10);
for(int i=1;i<=n;i++){
s+=to_string(i);
}
for(auto ch:s){
v[ch-'0']++;
}
cout<<v[x]<<endl;
return 0;
}
