ShuWan @ 2024-05-14 21:08:46
n,m=map(int,input().split()) result=list(input().split()) result.sort() print(result[m])
by cpu_gal @ 2024-05-14 21:09:48
e
by ShuWan @ 2024-05-14 21:32:54
@xiaosubing 现在把result输入改为map(int,input().split()),但是显示内存爆了家人们,是内置函数sort出的问题吗?
by starish @ 2024-05-30 19:31:08
@ShuWan 分治思想,不是叫你快排!!!时间复杂度可以优化到O(n)
by zhuyucheng6046 @ 2024-06-01 19:20:46
你要把``` cin>>t;改为scanf("%d",&t); 下一个cin也一样 正确代码:
using namespace std; int a,b; int main() { scanf("%d%d",&a,&b); int n[a]; for(int i=0;i<a;i++) scanf("%d",&n[i]); sort(n,n+a); cout<<n[b]<<endl; return 0; } //简单代码 求关注!