1029. Median (25)这题直接sort就过了

#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long LL;
const int Max=1000010;
LL a1[Max],a2[Max];
int main(){
int n1,n2;
scanf("%d",&n1);
for(int i=1;i<=n1;i++){
scanf("%lld",&a1[i]);
}
scanf("%d",&n2);
for(int i=1;i<=n2;i++){
scanf("%lld",&a1[i+n1]);
}
sort(a1+1,a1+n1+n2+1);
printf("%d",a1[(n1+n2+1)/2]);
return 0;
}
展开阅读全文

没有更多推荐了,返回首页