7-53 两个有序序列的中位数 (25分)
AC代码
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> v;
int main(){
int n, num;
scanf("%d", &n);
for (int i = 1; i <= 2*n; i++){
scanf("%d", &num);
v.push_back(num);
}
sort(v.begin(), v.end());
printf("%d", v[(2*n-1)/2]);
return 0;
}