You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
500 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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;
}