Files
python/TangDou/LuoGuBook/P1469.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

18 lines
500 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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