HDU6702 ^&^(思维)

HDU6702 ^&^

目标为 ((A oplus C) & (B oplus C) = 0) ,易得:

  • (A & B=0) 时:(C = 1)
  • (A & B e0) 时:(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
", ans);
    }
    return 0;
}
原文地址:https://www.cnblogs.com/solvit/p/11406161.html