题解 | #明明的随机数#

明明的随机数

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

#include <iostream>
#include <map>
using namespace std;
#define x first
#define y second
int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    //利用map直接自动去重加上排序,一步到位
    for(int i = 0; i < n; i ++)
    {
        int x;
        cin >> x;
        mp[x] = 1;
    }
    for(auto t : mp)    cout << t.x << endl;
    return 0;
}

全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

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