1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include<iostream> using namespace std; int main(){ int n,m; unsigned long long num[10]={0}; cin>>m>>n; for(int i=m;i<=n;i++){ int a=i; while(a>0){ switch(a%10){ case 0:num[0]++;break; case 1:num[1]++;break; case 2:num[2]++;break; case 3:num[3]++;break; case 4:num[4]++;break; case 5:num[5]++;break; case 6:num[6]++;break; case 7:num[7]++;break; case 8:num[8]++;break; case 9:num[9]++;break; } a/=10; } } for(int i=0;i<=9;i++){ cout<<num[i]<<" "; } cout<<"\n"; return 0; }
|