#include <stdio.h> int main() { int n = 0, m = 0; scanf("%d%d", &n, &m); int arr1[n]; int arr2[m]; int arr3[m + n]; //定义变长数组 int i = 0; for (i = 0; i < n; i++) { //初始化数组arr1 scanf("%d", &arr1[i]); } for (i = 0; i < m; i++) { //初始化数组arr2 scanf("%d", &arr2[i]); } for (i = 0; i < n; i++) { //把arr1中的n个元素传递给arr3 arr3[i] = arr1[i]; } for (i = n; i < m + n; i++) { //把arr2中的m个元素传递给arr3 arr3[i] = arr2[i - n]; } //对arr3[m+n]进行冒泡排序完成升序排列 int j = 0; for (i = 0; i < m + n - 1; i++) { //共进行m+n-1轮冒泡排序 for (j = 0; j < m + n - 1; j++) { //每轮冒牌排序进行m+n-1次相邻元素大小比较 int tem = 0; if (arr3[j] > arr3[j + 1]) { tem = arr3[j]; arr3[j] = arr3[j + 1]; arr3[j + 1] = tem; } } } for (i = 0; i < m + n; i++) { printf("%d ", arr3[i]); } return 0; }