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

提取不重复的整数

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

import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        ArrayList<Integer> list=new ArrayList<Integer>();
        int bit;
        while(n>0){
            bit=n%10;
            n=n/10;
            if(!list.contains(bit))list.add(bit);
        }
        for(int s:list)System.out.print(s);
    }
}

全部评论

相关推荐

01-30 09:45
燕山大学 Java
喵_coding:这种直接跑就完事了 哪有毕业了才签合同 任何offer和三方都没有的
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
01-01 11:31
字节 算法 38x15 +15W 大专
沉淀小子:每次看到这种侮辱价直接拒的装逼仔,就想你是不是秒接了然后在这里装逼,有啥侮辱的。你要真有钱,还需要打工?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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