题解:P13685 【MX-X16-T3】「DLESS-3」XOR and Impossible Problem
其实这题也不是很难,我们充分发扬人类智慧,直接暴力过,求管理员大大让我水过题解!!!
上代码!!!
注意事项:要用 unsigned long long !!!
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<unsigned long> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
unsigned long long ans = 1;
bool f = true; //判断是否不是0
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
ans *= (a[i] ^ a[j]);
if (!ans){//如果为0直接结束
f = false;
break;
}
}
if (!f){
break;
}
}
cout << ans << endl;
}
return 0;
}