#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long
void solve() {
int o, x, p;cin >> o >> x >> p;
if (o == 1) {
x <<= p;
x &= (1 << 12) - 1;
}
else if (o == 2) {
x >>= p;
x |= ((1 << p) - 1) << (12 - p);
}
else if (o == 3) {
x &= LLONG_MAX ^ 1 << p;
}
else {
x |= 1 << p;
}
cout << x << endl;
}
/*
*/
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int t = 1;
cin >> t;
for (int i = 1; i <= t; i++) {
//cout << "----Test " << i << "----" << endl;
solve();
}
return 0;
}
自己造一个掩码进行位运算操作即可

京公网安备 11010502036488号