假入门?没关系13行秒了
2024-08-13 15:40:04
发布于:湖南
19阅读
0回复
0点赞
#include <iostream>
#include <cstdio>
using namespace std;
int a[1005], b[1005], c[2005];
int n, m, i = 1, j = 1, k = 1;
int main(){
cin >> n >> m;
for(int i = 1; i <= n + m; i++) cin >> (i <= n ? a[i] : b[i - n]);
while(i <= n && j <= m) c[k++] = (a[i] < b[j] ? a[i++] : b[j++]);
while(i <= n) c[k++] = a[i++]; while(j <= m) c[k++] = b[j++];
for(int i = 1; i <= n + m; i++) cout << c[i] << ' ';
return 0;
}
甚至
全部评论 1
69
2024-08-13 来自 湖南
0
有帮助,赞一个