#include <stdio.h> int main() { int m = 0; int n = 0; int arr1[100] = { 0 }; int arr2[100] = { 0 }; int arr3[200] = { 0 }; //输入 scanf("%d %d", &n, &m); for (int i = 0; i < n; i++) { scanf("%d", &arr1[i]); } for (int j = 0; j < m; j++) { scanf("%d", &arr2[j]); } //合并 int i = 0; int j = 0; int k = 0; while (i != n && j != m) { arr3[k] = (arr1[i] < arr2[j]) ? arr1[i] : arr2[j]; k++; if (arr1[i] < arr2[j]) { i++; } else { j++; } } if (i == n) { for (; j < m; j++) { arr3[k] = arr2[j]; k++; } } else if (j == m) { for (; i < n; i++) { arr3[k] = arr1[i]; k++; } } //输出 for (i = 0; i < m + n; i++) { printf("%d ", arr3[i]); } return 0; }