wgl2009 @ 2021-04-05 07:40:20
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int n,k;
int a[100005];
int main()
{
cin>>n>>k;
for(int i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
cout<<a[k-1]<<endl;
return 0;
}
by wgl2009 @ 2021-04-05 07:45:39
提交记录
by Textbook_blasphemy @ 2021-04-05 07:49:25
@wgl2009 格局数组小了,andsort
被卡
by wgl2009 @ 2021-04-05 09:53:08
@陶(戴)佳伟
sort为什么会被卡
by wgl2009 @ 2021-04-05 09:55:03
@陶(戴)佳伟
数组开大了,但结果却是这样:提交记录
by Textbook_blasphemy @ 2021-04-05 09:55:18
@wgl2009 你算算时间复杂度呗。。。
by wgl2009 @ 2021-04-05 10:00:12
@陶(戴)佳伟
时间复杂度是这样算吗:n*log2(n)
by Textbook_blasphemy @ 2021-04-05 10:03:11
@wgl2009
读入
排序
询问
by wgl2009 @ 2021-04-05 10:26:47
??
by wgl2009 @ 2021-04-05 10:36:49
@陶(戴)佳伟
改了一下,结果是这样
by cancer_3_26 @ 2021-04-13 15:05:56
建议别用sort