#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
int i, n, m, e, r, p, j;
while(cin >> n && n<=20)
{
for(i=1; i<=n; i++)
{
cin >> m;
int a[10] = {0};
for(j=1; j<=m; j++)
{
if(j>9)
{
e = j;
while(e!=0)
{
r = e%10;
s.push_back(r+48);
e = e/10;
}
}
else
s.push_back(j+48);
}
p = s.size();
while(p--)
{
if(s[p] - 48 == 0)
{
a[0]++;
}
else if(s[p] - 48 == 1)
{
a[1]++;
}
else if(s[p]-48 == 2)
{
a[2]++;
}
else if(s[p] - 48 == 3)
{
a[3]++;
}
else if(s[p]-48 == 4)
{
a[4]++;
}
else if(s[p] - 48 == 5)
{
a[5]++;
}
else if(s[p]- 48 == 6)
{
a[6]++;
}
else if(s[p] - 48 == 7)
{
a[7]++;
}
else if(s[p] - 48 == 8)
{
a[8]++;
}
else if(s[p]- 48 == 9)
{
a[9]++;
}
}
for(j=0; j<10; j++)
{
cout << a[j] << " ";
}
cout << endl;
s.clear();
}
}
return 0;
}
using namespace std;
int main()
{
string s;
int i, n, m, e, r, p, j;
while(cin >> n && n<=20)
{
for(i=1; i<=n; i++)
{
cin >> m;
int a[10] = {0};
for(j=1; j<=m; j++)
{
if(j>9)
{
e = j;
while(e!=0)
{
r = e%10;
s.push_back(r+48);
e = e/10;
}
}
else
s.push_back(j+48);
}
p = s.size();
while(p--)
{
if(s[p] - 48 == 0)
{
a[0]++;
}
else if(s[p] - 48 == 1)
{
a[1]++;
}
else if(s[p]-48 == 2)
{
a[2]++;
}
else if(s[p] - 48 == 3)
{
a[3]++;
}
else if(s[p]-48 == 4)
{
a[4]++;
}
else if(s[p] - 48 == 5)
{
a[5]++;
}
else if(s[p]- 48 == 6)
{
a[6]++;
}
else if(s[p] - 48 == 7)
{
a[7]++;
}
else if(s[p] - 48 == 8)
{
a[8]++;
}
else if(s[p]- 48 == 9)
{
a[9]++;
}
}
for(j=0; j<10; j++)
{
cout << a[j] << " ";
}
cout << endl;
s.clear();
}
}
return 0;
}
Comments
Post a Comment