https://www.nowcoder.com/discuss/92989?type=2&order=3&pos=63&page=3

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <bits/stdc++.h>
using namespace std;

int main()
{
int n, m, column, cnt[1005];
memset(cnt, 0, sizeof(cnt));
cin >> n >> m;
for (int i = 0; i < m; i++) {
cin >> column;
cnt[column]++;
}
cout << *min_element(cnt + 1, cnt + n + 1) << endl; // 列数从1开始
return 0;
}