题解 | #整型数组合并#
整型数组合并
http://www.nowcoder.com/practice/c4f11ea2c886429faf91decfaf6a310b
import java.util.*;
import java.io.*;
public class Main{
public static void main(String [] args) throws Exception{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
int a= Integer.parseInt(bf.readLine());
String [] arr_a = bf.readLine().split(" ");
int b= Integer.parseInt(bf.readLine());
String [] arr_b = bf.readLine().split(" ");
int [] all = new int[a+b];
for(int i=0; i<a;i++){
all[i]=Integer.parseInt(arr_a[i]);
}
for(int i=0; i<b;i++){
all[a+i]=Integer.parseInt(arr_b[i]);
}
Arrays.sort(all);
StringBuilder sb = new StringBuilder();
for(int i=0; i<a+b;i++){
if (i>0 && all[i-1] ==all[i]){
continue;
}
sb.append(all[i]);
}
System.out.println(sb);
}
}