-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUVA_1225.cpp
76 lines (75 loc) · 1.29 KB
/
UVA_1225.cpp
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include<vector>
#include<iostream>
#include<queue>
#include<string.h>
#include<stdio.h>
#include<stdlib.h>
#include<fstream>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<cstdio>
#include<stack>
#include<cmath>
#include<utility>
#include<list>
#include <string>
#include<map>
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define PI acos(-1.0)
#define inf 1<<30
#define DI(n) int n;scanf("%d",&n)
#define DII(a,b) int a,b;scanf("%d %d",&a,&b)
#define DIII(a,b,c) int a,b,c;scanf("%d %d %d",&a,&b,&c)
using namespace std;
int arr[11];
int main() {
freopen("input.txt", "r", stdin);
int t;
cin >> t;
for (int i = 0; i < t; i++) {
memset(arr, 0, sizeof(arr));
int n;
cin >> n;
int h = 1,l=0,m=0,p =0,q = 0;
for (int j = 1; j <= n; j++) {
if (h > 9) {
l++;
h = 0;
}
if (l > 9) {
m++;
l = 0;
}
if (m > 9) {
p++;
m = 0;
}
if (p > 9) {
q++;
p = 0;
}
if (j >= 10000) {
arr[q]++;
}
if (j >= 1000) {
arr[p]++;
}
if (j >= 100) {
arr[m]++;
}
if (j>=10) {
arr[l]++;
}
arr[h++]++;
}
for (int j = 0; j < 9; j++) {
cout << arr[j] << " ";
}
cout << arr[9];
cout << endl;
}
return 0;
}