合肥工业大学oj 1355 阵前第一功

//使用set的查重功能
//再逆向迭代器一下
#include<iostream>
#include<set>
using namespace std;

int T, N, K;

int main(){    
    cin >> T;
    while(T--) {
        set<int> set;
        cin >> N;
        for(int j = 0; j < N; j++) {
            int num;
            cin >> num;
            set.insert(num);
        }
        cin >> K;
        std::set<int>::iterator it = set.end();
        while(K--) it--;
        cout << *it << endl; 
    }
        
    return 0;
} 

//presented by 大吉大利,今晚AC

猜你喜欢

转载自blog.csdn.net/lalala_HFUT/article/details/88063737