- 「一本通 5.3 练习 4」数字计数
- 对拍
- @ 2025-6-3 13:25:28
#include<bits/stdc++.h>
#define int long long
using namespace std;
int ans[10];
void fun(int x)
{
	if(!x)
	{
		ans[0]++;
		return;
	}
	int num[14],tot=0;
	while(x)
	{
		num[++tot]=x%10;
		x/=10;
	}
	for(int i=1;i<=tot;i++)
		ans[num[i]]++;
}
signed main()
{
	int a,b;cin>>a>>b;
	for(int i=a;i<=b;i++)
		fun(i); 
	for(int i=0;i<=9;i++)
		cout<<ans[i]<<" ";
}
0 comments
  
  No comments so far...
            Information
- ID
- 171
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 50
- Accepted
- 11
- Uploaded By
 
      