找出落单的那个数
作者:互联网
题目如下:
import java.util.Scanner;
public class Demo_找出落单的那个数 {
/**
* @param args
*/
public static void main(String[] args) {
int a[] = new int[5];
Scanner sc = new Scanner(System.in);
for (int i = 0; i < a.length; i++) {
a[i]=sc.nextInt();
}
//辅助数组来做,如果只出现一次,就是1喽
int helper[] = new int[5];
for (int i = 0; i < helper.length; i++) {
helper[a[i]]++;
}
for (int i = 0; i < helper.length; i++) {
if (helper[i]==1) {
System.out.println(i);
}
}
}
}
标签:落单,那个,找出,Scanner,helper,int,++,length,new 来源: https://blog.csdn.net/qq_43966129/article/details/104905200