当前位置:网站首页>HJ明明的随机数
HJ明明的随机数
2022-06-28 07:36:00 【有勇气的牛排】
描述
明明生成了NN个1到500之间的随机整数。请你删去其中重复的数字,即相同的数字只保留一个,把其余相同的数去掉,然后再把这些数从小到大排序,按照排好的顺序输出。
数据范围: 1≤n≤1000,输入的数字大小满足500≤val≤500
输入描述:
第一行先输入随机整数的个数 N 。 接下来的 N 行每行输入一个整数,代表明明生成的随机数。 具体格式可以参考下面的"示例"。
输出描述:
输出多行,表示输入数据处理后的结果
示例:
输入:3
2
2
1
输出:1
2
说明:输入解释:
第一个数字是3,也即这个小样例的N=3,说明用计算机生成了3个1到
500之间的随机整数,接下来每行一个随机数字,共3行,也即这3个随
机数字为:
2
2
1
所以样例的输出为:
1
2
牛客HJ:python3:
nums = []
N = input()
while True:
try:
nums.append(int(input()))
except:
break
list2 = list(set(nums))
list2.sort()
for i in list2:
print(i)
边栏推荐
- Construction and exploration of vivo database and storage platform
- Detailed explanation of collection class methods____ (4) Judgment and assignment, etc
- Unity-UI-shadow组件
- Makefile
- flutter 实现摇一摇功能
- 实时数据库 - 笔记
- Force buckle 515 Find the maximum value in each tree row
- In idea, the get and set methods may be popular because the Lombok plug-in is not installed
- ACM笔记
- [ thanos源码分析系列 ]thanos query组件源码简析
猜你喜欢

Safety training is the greatest benefit for employees! 2022 induction safety training for new employees

卸载重装最新版mysql数据库亲测有效

mysql57 zip文件安装

Introduction and several months' experience of extending the solution thanos of Prometheus

Design and implementation of spark offline development framework

PLC -- 笔记

Mysql57 zip file installation

Cloud native (to be updated)

ACM notes

What should I do if the version is incompatible with the jar package conflict?
随机推荐
Ice, protobuf, thrift -- Notes
8 figures | analyze Eureka's first synchronization registry
Solving the longest palindrome substring by dynamic programming
Is it safe to open an account on Dongfang fortune
A single node obtains the lock lock of the order number
ACM笔记
Block transmission by golang gin framework
NDK 交叉编译
Source code analysis of kubernetes' process of deleting pod
R language hitters data analysis
Implementation of commit message standardized control in large projects
Analyze 5 indicators of NFT project
R language Kolmogorov Smirnov tests whether the two samples follow the same distribution.
Path alias specified in vite2.9
Installing redis on Linux
Jetpack - defects of livedata component and Countermeasures
Devtools implementation principle and performance analysis practice
Alibaba cloud server creates snapshots and rolls back disks
Uninstall and reinstall the latest version of MySQL database. The test is valid
open62541直接导入NodeSet文件