#include <stdio.h> #include<malloc.h> int* Bsort(int* a, int len) { for (int i = 0; i < len; i++) { for (int j = 0; j < len - i - 1; j++) { if (a[j] > a[j + 1]) { int t = a[j]; a[j] = a[j + 1]; a[j + 1] = t; } } } return a; } int main() { int n, m; scanf("%d %d", &n, &m); int* arr = (int*)malloc(n * sizeof(int)); int* brr = (int*)malloc(m * sizeof(int)); int val[10000]; for (int i = 0; i < n; i++) { scanf("%d", &arr[i]); } for (int i = 0; i < m; i++) { scanf("%d", &brr[i]); } // Bsort(arr, n); // Bsort(brr, m); //连接 for (int i = 0; i < n; i++) { val[i] = arr[i]; //arr放入数组val } for (int i = 0; i < m; i++) { val[n + i] = brr[i]; } Bsort(val, m + n); for (int i = 0; i < m + n; i++) { printf("%d ", val[i]); } free(arr); free(brr); return 0; }