yudw1316:#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <sstream>
using namespace std;
int partition(vector<int> &arr, int i, int j)
{
int I = i;
while (i < j)
{
while (i < j && arr[j] >= arr[I]) --j;
while (i < j && arr[i] <= arr[I]) ++i;
if (i < j) std::swap(arr[i], arr[j]);
}
std::swap(arr[i], arr[I]);
return i;
}
int get_least_k(vector<int> &vec_input, int k)
{
int n = vec_input.size();
if (n == 0 || k <= 0 || k > n)
return 0;
int start_index = 0;
int end_index = n - 1;
int index = partition(vec_input, start_index, end_index);
while (index != k - 1) // 当分划元素的下标是k-1时,意味着前k-1个数比次数小(不大于),后边的数比次数大(不小于)
{
if (index > k - 1)
index = partition(vec_input, start_index, index - 1);
else if (index <= k - 1)
index = partition(vec_input, index + 1, end_index);
}
return vec_input[index];
}
int main()
{
vector<int> vec_num;
int val;
string line;
stringstream ss;
getline(cin, line);
ss.clear();
ss << line;
while (!ss.eof())
{
ss >> val;
vec_num.push_back(val);
}
int k;
cin >> k;
cout << get_least_k(vec_num,vec_num.size() + 1 - k) << endl;
return 0;
}