#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int rec[10] = {};
for (int i = 1; i <= n; i++) {
string s = to_string(i);
for (int i = 0; i < s.size(); i++) {
rec[s[i] - '0']++;
}
}
for (int i = 0; i < 10; i++) {
cout << rec[i] << (i < 9 ? " " : "\n");
}
}
return 0;
}
习题3-3 UVA1225 数数字 Digit Counting
最新推荐文章于 2022-01-19 20:31:16 发布