#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
int a[N] , n;
int main(){
int k ;
cin >> n >> k ;
for (int i = 0; i < n; i ++ ) cin >> a[i] ;
nth_element(a, a+k-1, a+n) ;
cout << a[k-1];
return 0;
}
—— 本文来自火龙信奥(义乌睿码科技):义乌青少年信息学奥赛与编程教育平台,专注 CSP-J/S、NOIP、GESP 竞赛培训,线上线下融合教学,助力编程升学。网址:hlcoding.com