解题思路:
注意事项:
参考代码:
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语言程序设计教程(第三版)课后习题8.9 (C语言代码)浏览:1710 |
不容易系列 (C语言代码)浏览:664 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:559 |
A+B for Input-Output Practice (III) (C语言代码)浏览:569 |
1009题解浏览:722 |
1908题解浏览:633 |
数对 (C语言代码)浏览:697 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:553 |
1124题解浏览:591 |
蓝桥杯历届试题-翻硬币 (C++代码)浏览:872 |