1、题目描述:点击打开链接
2、本题注意break的应用
#include <iostream>
#include<cstring>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int s[10];
int main(int argc, char** argv) {
int t;
cin>>t;
while(t){
t--;
int x;
cin>>x;
memset(s,0,sizeof(s));
for(int i=1;i<=x;i++){
if(i>=10){
int a=i%10;
int b=i/10;
s[a]+=1;
s[b]+=1;
continue;
}
s[i]+=1;
}
for(int i=0;i<10;i++){
cout<<s[i]<<' ';
}
cout<<endl;
}
return 0;
}