EEOJ/OJ1/bin.cpp

28 lines
506 B
C++
Raw Permalink Normal View History

2024-07-03 16:37:16 +00:00
#include<iostream>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
int a[32] = { 0 };
unsigned int n, num, pos, ansnum = 0;
int ans[32] = { 0 };
cin >> n;
//file >> n;
for (int i = 0; i < 3 * n - 1; i++) {
cin >> num;
//file >> num;
for (pos = 0; pos < 32; pos++) {
if((num>>pos)&1)
a[pos] += 1;
}
}
for (int i = 0; i < 32; i++) {
if (a[i] % 3) {
ans[i] = 1;
}
}
for (int i = 0; i < 32; i++) {
ansnum *= 2;
ansnum += ans[31-i];
}
cout << ansnum;
}