mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
P1138 第k小整数
R39029021
This commit is contained in:
parent
b4f39098f2
commit
9cfc6a041d
22
problem/P1138/P1138.cpp
Normal file
22
problem/P1138/P1138.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
// R39029021
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int n, a[10005], k;
|
||||
cin >> n >> k;
|
||||
for (int i = 0; i < n; i++) {
|
||||
cin >> a[i];
|
||||
}
|
||||
sort(a, a + n);
|
||||
n = unique(a, a + n) - a;
|
||||
if (k >= n) {
|
||||
cout << "NO RESULT" << endl;
|
||||
}
|
||||
else {
|
||||
cout << a[--k];
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user