You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
466 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include<bits/stdc++.h>
using namespace std;
int n, k, a[10000];//定义变量和数组
int main() {
cin >> n >> k;
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a + n);//快排数组a
int ans = unique(a, a + n) - a;//给数组a去重并保留ans=去重后非伪的长度
if (k < ans)
cout << a[k - 1]; //如果去重以后k<=ans则输出对应的数
else cout << "NO RESULT";//否则输出 NO RESULT
return 0;
}