him_out @ 2024-09-11 10:55:21
全RE求帮忙! sort什么的都不行。
#include<bits/stdc++.h>
using namespace std;
int s[5000001];
int main()
{
int n,a;
scanf("%d%d",&n,&a);
for(int i = 0;i<n;i++)
{
scanf("%d",s[i]);
}
nth_element(s,s+a,s+n);
printf("%d",s[a]);
return 0;
}
by _chicken_ @ 2024-09-11 10:58:40
by _chicken_ @ 2024-09-11 10:59:43
sort(s+1,s+n+1);
printf("%d",s[a+1]);
by _chicken_ @ 2024-09-11 11:00:49
呃,等会,如果你从0开始那当我没说
by _chicken_ @ 2024-09-11 11:03:32
@him_out 你的scanf("%d",s[i]);错了
少了&
by _chicken_ @ 2024-09-11 11:04:18
已过
by him_out @ 2024-09-11 19:49:06
感谢