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

提取不重复的整数

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

import java.io.*;

public class Main{

public static void main(String [] args) throws Exception{
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    int num = Integer.parseInt(bf.readLine());
    int [] arr = new int[10];
    StringBuilder sb = new StringBuilder();
    int divisor=10;
    int temp ;
    while (num>0){
        temp = num % 10;
         num /=divisor;
        if(arr[temp] == 1){
            continue;
        }
        arr[temp] = 1;
        sb.append(temp);
    }
    System.out.println(sb);
    
}

}

全部评论

相关推荐

06-27 15:29
门头沟学院 Java
点赞 评论 收藏
分享
05-14 20:34
门头沟学院 Java
窝补药贝八股:管他们,乱说,反正又不去,直接说680
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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