原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5210
简单题如下:
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstdio>
using std::sort;
const int Max_N = ;
int arr[Max_N];
int main() {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w+", stdout);
#endif
int n, k, tot, ret, cnt;
while (~scanf("%d", &n)) {
tot = ;
for (int i = ; i < n; i++) scanf("%d", &arr[i]);
scanf("%d", &k);
sort(arr, arr + n);
for (int i = ; i < n;) {
ret = arr[i], cnt = ;
for (; ret == arr[i]; i++) cnt++;
tot++;
}
if (n - tot <= k) printf("%d\n", n - k);
else printf("%d\n", tot);
}
return ;
}