文章
81
粉丝
2
获赞
530
访问
13.4k
#include <iostream>
using namespace std;
int main() {
int s1, s2;
int a[105], b[105];
cin >> s1;
for (int i = 0; i < s1; i++) {
cin >> a[i];
}
cin >> s2;
for (int i = 0; i < s2; i++) {
cin >> b[i];
}
int i = 0, j = 0;
bool first = true;
while (i < s1 && j < s2) {
if (a[i] <= b[j]) {
if (!first) cout << " ";
cout << a[i];
first = false;
i++;
} else {
if (!first) cout << " ";
cout << b[j];
first = false;
j++;
}
}
while (i < s1) {
if (!first) cout << " ";
cout << a[i];
first = false;
i++;
}
while (j < s2) {
if (!first) cout << " ";
cout << b[j];
first = false;
j++;
}
...
登录后发布评论
暂无评论,来抢沙发