#include <bits/stdc++.h>
using namespace std;
long long t,x,y,h,ans;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);//快读
cin>>t;
while(t--) {
ans=0;
cin>>x>>y>>h;
for (int i=0;i<h;i++){
long long q=ans+(1<<i);//枚举二进制第i位是1;
//此时ans相当于二进制第i位是0;
if ((x^ans)*(y^ans)<(x^q)*(y^q)){//如果二进制第i位是1大于第i位是0时,则第i位改为1,即ans=q;
ans=q;
}
}
cout<<(x^ans)*(y^ans)<<endl;//输出
}
return 0;
}题解:P13684 【MX-X16-T2】「DLESS-3」XOR and Multiply
文章信息与版本
文章信息
- 收录
- 2025年12月12日
- 更新
- 2025年12月12日
- 篇幅
- 约 1 分钟
- 题目
- P13684
版本
仅有当前版本