思路:
此题只需要两层循环,通过数组映射即可求出答案
AC代码:
cpp
#include<iostream>
using namespace std;
typedef long long ll;
const int N = 10;
int a[N];
int main()
{
ll n,m;
cin >> n >> m;
for(ll i=n;i<=m;i++)
{
ll num = i;
while(num != 0)
{
ll c = num % 10;
a[c] ++;
num /= 10;
}
}
for(int i=0;i<N;i++) cout << a[i] << ' ';
return 0;
}