题解 | #有序序列合并#
有序序列合并
https://www.nowcoder.com/practice/a9e943b0dab142759807d0cfb6863897
import java.util.Scanner; import java.util.Arrays; public class Main { public static void main(String[] args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); int[] arr1=new int[n+m]; for(int i=0;i<n;i++){ arr1[i]=sc.nextInt(); } for(int j=n;j<n+m;j++){ arr1[j]=sc.nextInt(); } Arrays.sort(arr1); for(int i=0;i<n+m;i++){ System.out.print(arr1[i]+" "); } sc.close(); } }