LanQiaoTestCodes/LQ_008.java

23 lines
391 B
Java
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package Course_Codes;
import java.util.Scanner;
//输入n和n-1个整数输出只出现1次的个数
public class LQ_008 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n,ans=0;//读入几个数
while(sc.hasNext()) {
n=sc.nextInt();
ans=0;
for(int i=0;i<n;i++) {
ans=ans^sc.nextInt();
}
System.out.print(ans);
}
}
}