解题思路:
注意事项:
参考代码:
import java.util.*; import java.math.*; public class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt(); if(n==0){ break; } HashSet<Integer> hs=new HashSet<>(); for(int i=0;i<n;i++){ hs.add(sc.nextInt()); } ArrayList list=new ArrayList(hs); Collections.sort(list); System.out.println(list.size()); for(int i=0;i<list.size();i++){ System.out.print(list.get(i)+" "); } System.out.println("\n"); } } }
0.0分
0 人评分
字符逆序 (C语言代码)浏览:643 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:531 |
C二级辅导-计负均正 (C语言代码)浏览:481 |
字符串比较 (C语言代码)浏览:685 |
简单的a+b (C语言代码)浏览:442 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:559 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:449 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:447 |
C二级辅导-阶乘数列 (C语言代码)浏览:660 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:496 |