#include<bits/stdc++.h>
using namespace std;
int num[1000005];
int main()
{
int n,x,temp;
long long ans=0;
cin>>n>>x;
while(n--)
{
cin>>temp;
ans+=num[temp^x];
num[temp]++;
}
cout<<ans<<endl;
return 0;
}742 B - Arpa’s obvious problem and Mehrdad’s terrible solution codeforces
最新推荐文章于 2025-10-10 17:41:03 发布
本文介绍了一种使用C++实现的位运算统计配对问题的解决方案。通过输入两个整数n和x,程序会计算出所有从1到n中每个整数与x进行异或操作后,在之前出现过的数中的匹配次数。
1万+

被折叠的 条评论
为什么被折叠?



