Files
python/LuoGu/RuMen/P1138_2.cpp

15 lines
480 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#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;
}