题目描述
解题思路
题目就是想询问一群数列中,该数当前是第几次出现
由于数据范围很小,所以可以根据数字作为数组下标,对数字出现的次数进行累加
代码实现
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1010;
int n;
int a[N];
int main()
{
cin >> n;
while (n --)
{
int x;
cin >> x;
a[x] ++;
cout << a[x] << " ";
}
return 0;
}