题目:异或求和
打表会发现只有四种情况
代码:
#include <iostream>
using namespace std;
typedef long long ll;
int main(void) {
ios::sync_with_stdio(false);
ll T;
cin >> T;
while(T--) {
ll n, ans = 0;
cin >> n;
if (n % 4 == 1) {
cout << 1 << endl;
}
else if (n % 4 == 2) {
cout << n+1 << endl;
}
else if (n % 4 == 3) {
cout << 0 << endl;
}
else {
cout << n << endl;
}
}
return 0;
}