Files
python/LuoGu/RuMen/P1138_2.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

15 lines
480 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}