---------------------------
AC代码:
1 import java.util.Scanner; 2 3 public class Main { 4 5 public static void main(String[] args) { 6 7 8 Scanner sc=new Scanner(System.in); 9 10 int times=sc.nextInt(); 11 while(times-->0){ 12 13 int n=sc.nextInt(); 14 int book[]=new int[100]; 15 16 for(int i=0;i<n*2;i++){ 17 book[sc.nextInt()]=1; 18 } 19 20 for(int i=0;i<book.length;i++){ 21 if(book[i]==1) System.out.print(i+" "); 22 } 23 System.out.println(); 24 25 } 26 27 } 28 29 }
题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=839