题解 | #整型数组合并#
整型数组合并
https://www.nowcoder.com/practice/c4f11ea2c886429faf91decfaf6a310b
// 1. 把内容读到vector数组中
// 2. 利用stable_sort进行排序
// 3. 打印排序后的数据
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int a, b;
vector<int> v;
int tmp;
cin >> a;
for(int i = 0; i < a; ++i){
cin >> tmp;
v.push_back(tmp);
}
cin >> b;
for(int i = 0; i < b; ++i){
cin >> tmp;
v.push_back(tmp);
}
stable_sort(v.begin(), v.end());
int priv;
int len = v.size();
for(int i = 0; i < len; ++i){
if(i == 0){
cout << v[i];
}else{
if(v[i] == priv){
continue;
}
cout << v[i];
}
priv = v[i];
}
}
// 64 位输出请用 printf("%lld")

