yang1812 @ 2023-11-05 20:42:16
#include<bits/stdc++.h>
using namespace std;
int n,k;
int main(){
scanf("%d%d",&n,&k);
int a[n];
for(int i = 0;i < n;i++){
scanf("%d",&a[i]);
}
sort(a , a + n);
printf("%d",a[k]);
}
by feizhu_QWQ @ 2023-11-05 20:46:34
首先你的思路就不对,你试下这个样例
5 3
1 1 1 2 3
如果后面都是一样的数怎么办
by feizhu_QWQ @ 2023-11-05 21:10:39
还有我看了深入浅出上面说了,这道题要用分治算法,
虽然我也没做出来
by feizhu_QWQ @ 2023-11-05 21:12:02
不会分治可以直接放弃了