2392: 【入门】【P1554】梦中的统计

内存限制:128 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:50 解决:22

题目描述

Bessie 的大脑反应灵敏,仿佛真实地看到了她数过的一个又一个数。她开始注意每一个数码(lns="http://www.w3.org/1998/Math/MathML">09):每一个数码在计数的过程中出现过多少次?

给出两个整数 lns="http://www.w3.org/1998/Math/MathML"> 和 lns="http://www.w3.org/1998/Math/MathML">,求在序列 lns="http://www.w3.org/1998/Math/MathML">[,+1,+2,,1,] 中每一个数码出现了多少次。

输入

第 lns="http://www.w3.org/1998/Math/MathML">1 行: 两个用空格分开的整数 lns="http://www.w3.org/1998/Math/MathML"> 和 lns="http://www.w3.org/1998/Math/MathML">

输出

第 lns="http://www.w3.org/1998/Math/MathML">1 行: 十个用空格分开的整数,分别表示数码 lns="http://www.w3.org/1998/Math/MathML">09 在序列中出现的次数。

样例输入 复制

129 137

样例输出 复制

1 10 2 9 1 1 1 1 0 1

提示

数据保证,lns="http://www.w3.org/1998/Math/MathML">12×109lns="http://www.w3.org/1998/Math/MathML">5×105

#include<iostream>
using namespace std;
int a[10];
int main(){
	int m,n;
	cin>>m>>n;
	for (int i=m;i<=n;i++) {
		int t=i;
		while (t>0) {
			a[t%10]++;
			t/=10;
		}
	}
	
	for (int i=0;i<=9;i++) {
		cout<<a[i]<<" "; 
	}
	return 0;
}