View Code of Problem 107

//计数;
#include<stdio.h>
#include<math.h>
int main(){
	int m,n;
	while(scanf("%d %d",&m,&n)!=EOF){
		int a[10]={0};
		int i;
		int d;
		int t;
		for(i=m;i<=n;i++){
			t=i;
			if(t>0&&t<10){
				a[t]++;
			}else{
			
			while(t>0){
				d=t%10;
				t=t/10;
				a[d]++;
			}}
		}
		for(i=0;i<10;i++){
			if(i<9){
				printf("%d ",a[i]);
			}else{
				printf("%d\n",a[i]);
			}
		}
	}
	return 0;
} 

Double click to view unformatted code.


Back to problem 107