import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n1 = sc.nextInt();
int n2 = sc.nextInt();
int a[] = new int[n1];
for (int i = 0; i < n1; i++) {
a[i] = sc.nextInt();
}
ArrayList<Integer> alB = new ArrayList<Integer>();
for (int i = 0; i < n2; i++) {
alB.add(sc.nextInt());
}
String sum = "";
for (int i = 0; i < n1; i++) {
if (alB.contains(a[i])) {
sum += (a[i] + " ");
}
}
if (sum.equals("")) {
System.out.println("NULL");
} else {
System.out.println(sum.substring(0, sum.length() - 1));
}
}
}
7-3 求集合交集 (20 分)jaav版
最新推荐文章于 2024-04-27 09:13:51 发布