题解 | #有序序列合并#

有序序列合并

http://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[] arr = new int[n + m];
        int index = 0;
        while(sc.hasNextInt()) {
            arr[index++] = sc.nextInt();
        }
        Arrays.sort(arr);
        for(int i = 0 ; i < n + m ; i++) {
            System.out.print(arr[i] + " ");
        }
    }
}
全部评论

相关推荐

点赞 评论 收藏
分享
评论
3
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务