题解 | 出现奇数次的数

出现奇数次的数

https://www.nowcoder.com/practice/b3bd694fd4c44b89a5c6b49d855121b8

#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
using PII=pair<ll,ll>;
using PIII=pair<int,pair<int,int>>;
const ld ESP = 1e-10;
const ld PI = acosl(-1);
const int N=1e6+10;
const int M=2e5+10;
// const int mod = 1000000007;
const int mod = 998244353;
//随机化
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(1, 1000000000);

void solve(){
    int n;
    cin>>n;
    map<int,int>f;
    for(int i=1;i<=2*n+1;i++){
        int x;
        cin>>x;f[x]++;
    }
    for(auto [x,d]:f){
        if(d&1)cout<<x;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int _=1;
    // cin>>_;
    while(_--){
        solve();
    }
    return 0;
}


全部评论

相关推荐

不愿透露姓名的神秘牛友
2025-11-25 00:23
牛客28967172...:这个项目不行,学生管理系统这个方向你做出花也没用,实在不行找些开源项目做做。 而且一个比赛奖项都没有,acm,icpc,蓝桥杯,实在不行数学建模或者你校内一些程序设计比赛都行。 对于没实习找实习的,奖项(国奖/省奖)>软著专利>开源项目(最好高star)>校内真实项目(加一些计算机社团,百分百有真实项目)
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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