//普通hashset,解法 import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int num = sc.nextInt(); HashSet<integer> hashtable = new HashSet<>(); int res = 0; int temp = 0; while(num / 10 != 0){ temp = num % 10; num /= 10; if(!hashtable.contains(temp)){ res = res * 10 + temp; hashtable.add(temp); } } if(!hashtable.contains(num)){//最后一个数字 res = res * 10 + num; } System.out.println(res); } }</integer>
点赞

相关推荐

08-23 21:29
已编辑
吉林师范大学 硬件开发
牛马人的牛马人生:前期急啥 前期神仙打架高端局ssp的高级大offer 都是佬们的战争
点赞 评论 收藏
分享
07-23 15:05
门头沟学院 Java
熊大不大:不好意思KPI数据刚刚刷新,刚刚达标
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务