mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-01-23 18:11:59 +00:00
P1239 计数器
R40245675
This commit is contained in:
parent
332460ff29
commit
204eb6c70a
20
problem/P1239/P1239.cpp
Normal file
20
problem/P1239/P1239.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <bits/stdc++.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
int n, ans[15], t;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
cin >> n;
|
||||||
|
for (int i = 1; i <= n; i++) {
|
||||||
|
t = i;
|
||||||
|
while (t) {
|
||||||
|
ans[t % 10]++;
|
||||||
|
t /= 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
cout << ans[i] << endl;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user