文章
211
粉丝
1
获赞
1178
访问
75.0k
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
while(cin >> n){
map<int,int> mp;
while(n--){
int x;
cin >> x;
mp[x] = 1;
}
int k;
cin >> k;
// 遍历map,找第k小的数
int count = 0;
for (auto it = mp.begin(); it != mp.end(); ++it) {
count++;
if (count == k) {
cout << it->first << endl;
break;
}
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发