HDU6702 ^&^(思维)

Posted solvit

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU6702 ^&^(思维)相关的知识,希望对你有一定的参考价值。

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;

以上是关于HDU6702 ^&^(思维)的主要内容,如果未能解决你的问题,请参考以下文章