思路:关于STL中set容器的使用
#include<bits/stdc++.h>
using namespace std;
const int MAXSIZE = 1010;
int a[MAXSIZE][MAXSIZE];
set<int> b[MAXSIZE];//set容器中每个值都唯一
int main()
{
int n, m, k;
cin >> n >> m >> k;
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++) {
cin >> a[i][j];
b[a[i][j]].insert(j);//set数组中插入列标,并进行自动去重
}
for (int i = 1; i <= k; i++)
cout << b[i].size()<<" ";//set数组的长度即为所求
return 0;
}