哈基米已睡着 • 6小时前
using namespace std;
int main() {
int n, sum = 0, t, q;
cin >> n;
int a[10001] = {0}, x = n / 2;
int k;
for (t = 0; t < n; t++) {
cin >> k;
a[k]++;//桶排序
}
for (q = 0; q < 10001; q++) {
`#include <bits/stdc++.h> using namespace std;
int main() {
int n, sum = 0, t, q;
cin >> n;
int a[10001] = {0}, x = n / 2;
int k;
for (t = 0; t < n; t++) {
cin >> k;
a[k]++;//桶排序
}
for (q = 0; q < 10001; q++) {
if (a[q] != 0) {
sum++;
}
}
if (sum > x) {
cout << x;
return 0;
} else {
cout << sum;
}
return 0;
}`
评论:
请先登录,才能进行评论