标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 68543 Accepted Submission(s):
19203
import java.util.ArrayList; import java.util.List; import java.util.Collections; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan =new Scanner(System.in); while(scan.hasNext()){ int n=scan.nextInt(); int m=scan.nextInt(); if(n==0&&m==0)break; List<Integer> a=new ArrayList<Integer>(); List<Integer> b=new ArrayList<Integer>(); for(int i=1;i<=n;i++){ int s=scan.nextInt(); a.add(s); } for(int i=1;i<=m;i++){ int s=scan.nextInt(); b.add(s); } a.removeAll(b); Collections.sort(a); if(a.isEmpty()) System.out.println("NULL"); else { for(int i=0;i<a.size();i++) {System.out.print(a.get(i)+" ");} System.out.println(); } } } }
标签:
原文地址:http://www.cnblogs.com/cwenliu/p/5757607.html