题解 | #Simple Sorting#

Simple Sorting

https://www.nowcoder.com/practice/139761e0b59a405786898b7f2db9423f

#include <iostream>
#include <map>
#include <vector>
using namespace std;

int main() {
    int a;
    while (cin >> a) { // 注意 while 处理多个 case
        vector<int>k(1001);
        for(int i=0;i<a;i++){
            int m;
            cin>>m;
            k[m]++;
        }
        for(int i=1;i<=1000;i++){
            if(k[i]>0){
                cout<<i<<" ";
            }
        }
        cout<< endl;
    }
}
// 64 位输出请用 printf("%lld")

全部评论

相关推荐

03-29 15:34
门头沟学院 Java
北斗导航Compass低仿版:能不能先搞清楚优先级啊,怎么可能是项目问题,项目很重要吗?又没学历 又没实习大厂凭啥约面?那玩具项目 没应用在真实生产环境下的 就算做上天又有什么用?早点找个小公司实习 拿小公司实习去投大厂实习,这才是你现在该做的
投递美团等公司8个岗位 简历被挂麻了,求建议
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务