题解 | #提取不重复的整数#
提取不重复的整数
http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1
数组判断是否重复
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] array = new int[10];
int sum = 0;
while(n>0){
if(array[n%10] != 1){
sum = sum*10 + n%10;
array[n%10] = 1;
}
n=n/10;
}
System.out.println(sum);
}
}