0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 02:58:48 +00:00

P1923 【深基9.例4】求第k小的数

R38818108
This commit is contained in:
Baoshuo Ren 2020-09-24 18:21:35 +08:00 committed by Baoshuo Ren
parent 4df57d2fda
commit 5e71c49e9d
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

16
problem/P1923/P1923.cpp Normal file
View File

@ -0,0 +1,16 @@
// R38818108
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, a[5000005];
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
nth_element(a, a + m, a + n); // sort(a, a+n);
printf("%d\n", a[m]);
return 0;
}