HDU6702 ^&^(思维)
目标为 \((A \oplus C) \& (B \oplus C) = 0\) ,易得:
- \(A \& B=0\) 时:\(C = 1\) 。
- \(A \& B\ne0\) 时:\(C = A \& B\) 。
#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;
}