【链家笔试题】问卷调查
来源:互联网 发布:php reflection的作用 编辑:程序博客网 时间:2024/05/16 06:40
思路
通过Java的TreeSet集合实现去重加排序的效果。
import java.util.Iterator;import java.util.Scanner;import java.util.TreeSet;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); TreeSet<Integer> set=new TreeSet<>(); for(int i=0;i<n;i++) { set.add(sc.nextInt()); } System.out.println(set.size()); Iterator<Integer> it=set.iterator(); StringBuilder stringBuilder=new StringBuilder(); while(it.hasNext()) { stringBuilder.append(it.next()+" "); } if(stringBuilder.length()>1) stringBuilder.deleteCharAt(stringBuilder.length()-1); System.out.println(stringBuilder.toString()); }}
阅读全文
0 0
- 【链家笔试题】问卷调查
- 问卷调查
- 问卷调查
- 链家笔试题
- 链家笔试题小记
- 链家笔试题总结
- 链家笔试题整理
- 链家笔试算法题
- KuGoo问卷调查
- 问卷调查系统
- 微信端问卷调查
- 开发者问卷调查
- 移动问卷调查、企业问卷调查解决方案
- 移动问卷调查、企业问卷调查解决方案
- 2018链家笔试编程题
- 【链家笔试题】部队分组
- 链表笔试题
- 链表笔试题
- Ubuntu16.04lTS安装qq文件时在处理时有错误发生:xxxi386问题
- 300. Longest Increasing Subsequence(DP经典问题)
- 利用豆瓣短评数据生成词云
- eclipse 设置默认编码为Utf-8
- Oracle11g安装(Linux)
- 【链家笔试题】问卷调查
- [NOIP2016真题]组合数问题
- 使用MySql replace into(insert into 的增强版)时你不得不注意的坑
- java新手如何简单的理解java数组中冒泡排序法是怎么实现排序的
- 安卓Activity详解(生命周期-以各种方式启动Activity-状态保存-完全退出)
- Several ports (8005, 8080, 8009) required解决办法
- hdu5152.Friend-Graph(CCPC网络赛)
- Mysql5.6升级到5.7步骤详解
- mac本地搭建伪分布式Hadoop和HBase遇到的问题