寻找唯一的萌妹(思维)

Description

 

又到了一年一度ACMer暑期留校集训的日子了,目前一共有2n+1个小萌新报名参加暑期集训,其中2n个是帅哥,只有1个萌妹子,这是多么的悲催!由于暑期训练强度大,坚持下来可不是一件容易的事情,DHG学长想到了一个巧妙的方法,两个人组成一队,两人互相鼓励,互相监督,直到集训顺利完成。然而,只有具有相同抗压能力的两位同学才能组在一起,并且这个唯一的萌妹子比较高傲不愿意和现有的2n个帅哥组队,只想和下一个报名的同学组队。作为仍未报名的你,想和这传说中的萌妹子组队,要求你输出萌妹子的抗压能力值。

Input

 

第一行一个n(n<=1000000)

第二行2n+1个数,表示每个小萌新的抗压能力值xi(-99999999<xi<99999999)。

Output

 

只输出一个数字,表示萌妹的抗压能力值。

Sample Input 1 

2
1 2 2 1 3

Sample Output 1

3

Sample Input 2 

1
-2 -2 1

Sample Output 2

1

Hint

题目保证:有正确答案;

亦或一边

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<cmath>

const int maxn=1e5+5;
typedef long long ll;
using namespace std;

int main()
{
    int n;
    cin>>n;
    int x;
    int ans=0;
    for(int t=0;t<2*n+1;t++)
    {
        scanf("%d",&x);
        ans^=x;
    }
    printf("%d",ans);
    
    return 0;
}
原文地址:https://www.cnblogs.com/Staceyacm/p/10862967.html