题解 | #明明的随机数#

明明的随机数

https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0

#include <iostream>
#include <set>
using namespace std;

int main() {
    int n,num;
    set<int> nums;
    cin>>n;
    while(n--){
       cin>>num; 
       nums.insert(num);
    }
    for(auto it=nums.begin();it!=nums.end();it++)
        cout<<*it<<endl;
    return 0;
}

题目要求:去重加排序

想到set容器的特点,直接使用

全部评论

相关推荐

白火同学:大二有这水平很牛了,可以适当对关键信息加粗一点,比如关键技术、性能指标之类的。
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务