18 lines
500 B
C++
18 lines
500 B
C++
#include <bits/stdc++.h>
|
||
|
||
using namespace std;
|
||
int x; //输入的每枝筷子的长度
|
||
int n; //筷子的总数
|
||
int ans;//奇数个,落单的长度是多少
|
||
|
||
int main() {
|
||
//不加这两句优化,第一个测试点TLE
|
||
ios::sync_with_stdio(false);
|
||
cin.tie();
|
||
|
||
cin >> n;
|
||
//一路走来一路异或,就可以把偶数个的消掉,最后剩下的就是单个的。
|
||
for (int i = 1; i <= n; i++) cin >> x, ans ^= x;
|
||
cout << ans << endl;
|
||
return 0;
|
||
} |