Description
我家有n张一模一样的诺亚奥特曼卡片,由于他具有穿越时间和空间的能力,就连拳头都包裹着火焰。我家孩子十分喜欢这些卡片,还给他们编了号,编号由1到n。但是他和同学们斗卡的时候不小心搞失一张。他现在逐个把剩下的n-1张卡的编号读出来(顺序当然是乱的),请你帮忙把丢失的编号尽快找出来
Format
Input
1 个整数N。
N-1个卡片编号,以空格分隔.
Output
1 个整数,丢失卡片的编号.
Samples
输入数据 1
8
8 6 5 4 2 3 1
Copy
输出数据 1
7
代码
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e6+10;
const int INF=0x3f3f3f3f;
int read(){int x=0,ans=1;char c=getchar();while(c>'9'||c<'0'){if(c=='-')ans=-1;c=getchar();}while(c>='0'&&c<='9'){x=x*10+(c-'0');c=getchar();}return x*ans;}
ll n,k,s;
int main(){
cin>>n;
for(int i=1;i<=n-1;i++){
cin>>k;
s=s^k^i;
}
s=s^n;
cout<<s<<endl;
}