滴滴8月26日第二道编程题输入
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <iostream>
using namespace std;
int kth(vector<int> &input, int k) {
sort(input.begin(), input.end());
return input[input.size() - k];
}
int main(int argc, char **argv) {
while(cin.peek() != EOF) {
int k;
vector<int> nums;
while(cin.peek() != '\n') {
int num;
cin >> num;
nums.push_back(num);
}
cin.get();
cin >> k;
cin.get();
int result = kth(nums, k);
cout << result << endl;
}
return 0;
}
#滴滴#