题解:P13685 【MX-X16-T3】「DLESS-3」XOR and Impossible Problem
zbl2012
·
·
题解
题目
闲话
md 考场没调出来68 pts,忘加判断 ans 了,不然400 pts(悲 。
题目大意
给出一个长度为 n 的非负整数序列,求:
\prod_{i=1}^n\prod_{j=i+1}^n(a_i\oplus a_j)
其中\oplus表示按位异或运算。
答案对 2^{64} 取余。
Solution
## Code
```
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull T,n,a[1000005],ans;
ull mod=pow(2,64);
int main(){
ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
for(cin>>T;T--;cout<<ans<<'\n'){
cin>>n;ans=1;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++){
ans*=(a[i]^a[j])%mod;
if(ans==0)break;
}
}
}
return 0;
}
```
~~红名彩笔第一次写题解,求管理大大过~~