View Code of Problem 107

#include<stdio.h>
// 二刷 
int main(){
	int cishu[10]={0};
	int m, n;
	while(scanf("%d %d", &m, &n) != EOF) { //输入包含多组数据
		int num = 0, k = 0;
		for(int i=m; i<=n; i++){
			num = i;
			do{
				k = num % 10;
				cishu[k]++;
				num /= 10;
			}while(num % 10 == 0);	
		}
		
		for(int i=0; i<10; i++){
			if(i==0) printf("%d", cishu[0]);
			else printf(" %d", cishu[i]);
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 107