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

提取不重复的整数

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();
    }
}
全部评论

相关推荐

喜欢核冬天的哈基米很想上市:会爆NullPointerException的
点赞 评论 收藏
分享
frutiger:逆天,我家就安阳的,这hr咋能说3k的,你送外卖不比这工资高得多?还说大厂来的6k,打发叫花子的呢?这hr是怎么做到说昧良心的话的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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