1#include<iostream> 2using namespace std; 3 4int m,n; 5int cnt[11]; 6int opera,ans[11]; 7void solve(int x) 8{ 9 int i,j,k; 10 if(x<=0) 11 return; 12 int one=x%10; 13 int ten=x/10; 14 x=ten; 15 for(i=0;i<=one;i++) 16 cnt[i]+=opera; 17 while(ten) 18 { 19 cnt[ten%10]+=(one+1)*opera; 20 ten/=10; 21 } 22 for(i=0;i<10;i++) 23 cnt[i]+=x*opera; 24 cnt[0]-=opera; 25 opera*=10; 26 solve(x-1); 27} 28 29int main() 30{ 31 int i,j,k; 32 while(cin>>m>>n) 33 { 34 if(m==0 && n==0) 35 break; 36 if(m>n) 37 m^=n^=m^=n; 38 39 opera=1; 40 memset(cnt,0,sizeof(cnt)); 41 solve(m-1); 42 for(i=0;i<10;i++) 43 ans[i]=cnt[i]; 44 memset(cnt,0,sizeof(cnt)); 45 opera=1; 46 solve(n); 47 for(i=0;i<9;i++) 48 cout<<cnt[i]-ans[i]<<' '; 49 cout<<cnt[9]-ans[9]<<endl; 50 } 51 return 0; 52}
|