***uva1225 number (table)

The meaning of the topic: Write the first n (n <= 10000) integers in order, 123456789101112···· How many times does the number of 0~9 appear (output 10 numbers, respectively, press 0,1,2, 3····9 occurrences)

#include <iostream>
#include <cstring>
Using namespace std;

Int main()
{
    Int arr[11][10005];
    Memset(arr,0,sizeof(arr));
    For(int i=1;i<=10005;i++)
    { int e=i;
        While (e)
        {
            Arr[e%10][i]++;
            e=e/10;
        }
        For(int j=0;j<10;j++)
            Arr[j][i]+=arr[j][i-1]; //打表 Suitable for the problem: the result sought needs to be repeated in the process and the amount of data on the table is not large
    }

    Int T;
    Cin >>T;
    While (T--)
    { int n;
        Cin >>n;
        For(int i=0;i<9;i++)
        Cout <<arr[i][n]<<" ";
        Cout <<arr[9][n]<<endl;
    }
    Return 0;
}