//a1 ^ a2 ^ ··· ^ an = 0 –>先手必败; //a1 ^ a2 ^ ··· ^ an != 0 –>先手必胜; #include<iostream> using namespace std; int main() { int n; cin >> n; int res = 0; while(n --) { int x; cin >> x; res ^= x; } if (res) puts("Yes"); else puts("No"); return 0; }
2022-08-26 12:06:46
//a1 ^ a2 ^ ··· ^ an = 0 –>先手必败; //a1 ^ a2 ^ ··· ^ an != 0 –>先手必胜; #include<iostream> using namespace std; int main() { int n; cin >> n; int res = 0; while(n --) { int x; cin >> x; res ^= x; } if (res) puts("Yes"); else puts("No"); return 0; }