Fork me on GitHub

NYOJ题目916胖子小的百宝袋

-------------------------------

AC代码:

 1 import java.util.Arrays;
 2 import java.util.Scanner;
 3 
 4 public class Main {
 5 
 6     public static void main(String[] args) {
 7         
 8         Scanner sc=new Scanner(System.in);
 9         
10         while(sc.hasNextInt()){
11             
12             int n=sc.nextInt();
13             int a[]=new int[n];
14             for(int i=0;i<a.length;i++) a[i]=sc.nextInt();
15             int b[]=new int[n];
16             for(int i=0;i<b.length;i++) b[i]=sc.nextInt();
17             
18             Arrays.sort(a);
19             Arrays.sort(b);
20             
21             for(int i=n-1;i>=0;i--){
22                 System.out.print(a[i]+" "+b[i]+" ");
23             }
24         }
25         
26     }
27     
28 }

 

题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=916

posted @ 2016-09-11 17:09  CC11001100  阅读(164)  评论(0编辑  收藏  举报