View Code of Problem 107

#include <stdio.h>
#include <string.h>
using namespace std;
int main(){
	int m,n;
	int cnt[10];
	while( ~scanf("%d%d", &m, &n )){
		memset(cnt,0,sizeof(int)*10);
		for( int i=m; i<=n; i++ ){
			int b = i;
			while( b>0 ){
				int d = b%10;
				cnt[d]++;
				b /= 10;
			}
		}
		for( int i=0; i<10; i++ ){
			printf("%d", cnt[i]);
			if( i<9 ) printf(" ");
			else printf("\n");
		}
	}

	return 0;
	
}

Double click to view unformatted code.


Back to problem 107