题解 | #提取不重复的整数#

提取不重复的整数

http://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1

import java.util.Scanner;
public class Main{
    public static void main(String []args){
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        int temp[] = new int [10];
        int bound = 0;
        for( ; num > 0; num /= 10){
            temp[bound++] = num % 10;
        }
        System.out.print(temp[0]);
        for(int i = 1; i < bound; i++){
            int count = 0;
            for(int j = 0; j < i; j++){
                if(temp[i] != temp[j]){
                    count++;
                }
                else{
                    break;
                }
            }
            if(count == i){
                System.out.print(temp[i]);
            }
        }
        in.close();
    }
}
全部评论

相关推荐

04-29 22:35
门头沟学院 Java
牛友说改了名字能收到offer:旧图新发查看图片
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务