75分求调
查看原帖
75分求调
1187849
FrankShix楼主2025/1/1 15:07
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int T;
    cin >> T;
    while (T--) 
	{
        long long n, s, t;
        cin >> n >> s >> t;
        if (s == t) {
            cout << 0 << endl;
            continue;
        }
        if (t == (1 << n) - 1)
        {
        	cout << (s ^ t) << endl;
        	continue;
		}
        long long ans = 0;
    	long long x = ((1 << n) - 1) ^ s;
        ans = s ^ x;
        if (x != t) 
            ans += x ^ t;
        cout << ans << endl;
    }
    return 0;
}

2025/1/1 15:07
加载中...