You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
571 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
int main() {
//录入数据到vector数组
int n;
cin >> n;
vector<int> vec;
for (int i = 0; i < n; i++) {
int c;
cin >> c;
vec.push_back(c);
}
//从第1个开始每一个向它前端找一样的数字然后加1就是本次出现的次数
for (int i = 0; i < n; i++) {
int count = 0;
for (int j = i; j >= 0; j--) {
if (vec[i] == vec[j])count++;
}
cout << count << " ";
}
return 0;
}