传送门 : CF 742B
题解
异或逆运算
AC code:
/*adrui's submission
Language : C++
Result : Accepted
Lover : zyy
Favorite : Dragon Balls
Standing in the Hall of Fame
*/
#include<iostream>
#include<cstring>
#include<cstring>
using namespace std;
#define ll long long
const int maxn = 100000 + 5;
ll n, x, vis[maxn];
int main() {
//freopen("in.txt", "r", stdin);
ll a;
while (cin >> n >> x) {
memset(vis, 0, sizeof(vis));
ll ans = 0;
cin >> a;
vis[a] = 1;
for (int i = 1; i < n; ++i) {
cin >> a;
ll t = x ^ a;
if (t <= 100000) {//限制
if (vis[t]) ans += vis[t];
}
++vis[a];
}
cout << ans << endl;
}
return 0;
}