目标为 \((A \oplus C) \& (B \oplus C) = 0\) ,易得:
#include<stdio.h>
using namespace std;
int t;
long long n, m, ans;
int main()
{
scanf("%d", &t);
for(int cas = 1; cas <= t; cas++){
scanf("%lld%lld", &n, &m);
ans = (n & m) == 0 ? 1 : (n & m);
printf("%lld\n", ans);
}
return 0;
}
原文:https://www.cnblogs.com/solvit/p/11406161.html