Files
python/TangDou/XiTi/1331.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

26 lines
571 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}